uiacceltk/hitchcock/plugins/alfoogmplugin/src/alfoogmplugin.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 07:56:43 +0200
changeset 0 15bf7259bb7c
child 8 46927d61fef3
permissions -rw-r--r--
Revision: 201003

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  OOM plugin for ALFserver.
*
*/

#include <ecom/ecom.h>
#include <ecom/implementationproxy.h>
#include <goommonitorplugin.h>
#include <w32std.h>

#include <alf/alfdirectclient.h>

class CAlfOogmMonitorPlugin : public CGOomMonitorPlugin
    {
public:
    CAlfOogmMonitorPlugin();
    ~CAlfOogmMonitorPlugin();
    void ConstructL();

public:
    void FreeRam(TInt aBytesToFree);
    void MemoryGood();

private:
    RAlfDirectClient iAlfDirectClient;
    };

// -----------------------------------------------------------------------------
// C++ constructor.
// -----------------------------------------------------------------------------
//
CAlfOogmMonitorPlugin::CAlfOogmMonitorPlugin()
    {
    }

// -----------------------------------------------------------------------------
// Destructor.
// -----------------------------------------------------------------------------
//
CAlfOogmMonitorPlugin::~CAlfOogmMonitorPlugin()
    {
    
    }

// -----------------------------------------------------------------------------
// Symbian two-phased constructor (2nd phase).
// -----------------------------------------------------------------------------
//
void CAlfOogmMonitorPlugin::ConstructL()
    {
    CGOomMonitorPluginBase::ConstructL();
    }


// -----------------------------------------------------------------------------
// Tries to free RAM.
// -----------------------------------------------------------------------------
//
void CAlfOogmMonitorPlugin::FreeRam(TInt aBytesToFree)
    {
 	iAlfDirectClient.EnableLowMemoryState(aBytesToFree);
    }

// -----------------------------------------------------------------------------
// CAlfOogmMonitorPlugin::MemoryGood
// -----------------------------------------------------------------------------
//
void CAlfOogmMonitorPlugin::MemoryGood()
    {
    iAlfDirectClient.EnableLowMemoryState(EFalse);	
    }

// -----------------------------------------------------------------------------
// Creates plugin.
// -----------------------------------------------------------------------------
//
TAny* CreatePlugin()
    {
    CAlfOogmMonitorPlugin* plugin = new(ELeave) CAlfOogmMonitorPlugin;
    CleanupStack::PushL(plugin);
    plugin->ConstructL();
    CleanupStack::Pop(plugin);
    return plugin;
    }

// -----------------------------------------------------------------------------
// Implementation table for plugin.
// -----------------------------------------------------------------------------
//
const TImplementationProxy ImplementationTable[] =
    {
    {{0xE4B6C988}, ::CreatePlugin}
    };

// -----------------------------------------------------------------------------
// ImplementationGroupProxy
// -----------------------------------------------------------------------------
//
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
    {
    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ;
    return ImplementationTable;
    }

// End of file