uigraphics/AknIcon/OomPlugin/AknIconOomPlugin.cpp
changeset 0 05e9090e2422
child 10 08459e712984
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <ecom/ecom.h>
       
    19 #include <ecom/implementationproxy.h>
       
    20 #include <oommonitorplugin.h>
       
    21 #include "AknIconSrvClient.h"
       
    22 #include "akniconconfig.h"
       
    23 
       
    24 class CAknIconOomMonitorPlugin : public COomMonitorPlugin
       
    25 	{
       
    26 public:
       
    27 	CAknIconOomMonitorPlugin();
       
    28 	~CAknIconOomMonitorPlugin();
       
    29 	void ConstructL();
       
    30 		
       
    31 public:
       
    32 	void FreeRam();
       
    33 	void MemoryGood();
       
    34 	};
       
    35 
       
    36 
       
    37 CAknIconOomMonitorPlugin::CAknIconOomMonitorPlugin()
       
    38 	{
       
    39 	}
       
    40 	
       
    41 CAknIconOomMonitorPlugin::~CAknIconOomMonitorPlugin()
       
    42 	{
       
    43 	RAknIconSrvClient::Disconnect();
       
    44 	}
       
    45 	
       
    46 void CAknIconOomMonitorPlugin::ConstructL()
       
    47 	{
       
    48 	COomMonitorPlugin::ConstructL();
       
    49 	User::LeaveIfError( RAknIconSrvClient::Connect() );
       
    50 	}
       
    51 	
       
    52 void CAknIconOomMonitorPlugin::FreeRam()
       
    53 	{
       
    54 	// disable the AknIcon cache and free all cached icons
       
    55 	AknIconConfig::EnableAknIconSrvCache( EFalse );
       
    56 	}
       
    57 	
       
    58 void CAknIconOomMonitorPlugin::MemoryGood()
       
    59 	{
       
    60 	// Re-enable AknIcon icon caching
       
    61 	AknIconConfig::EnableAknIconSrvCache( ETrue );
       
    62 	}
       
    63 
       
    64 
       
    65 TAny* CreatePlugin()
       
    66 	{
       
    67 	CAknIconOomMonitorPlugin* plugin = new(ELeave) CAknIconOomMonitorPlugin;
       
    68 	CleanupStack::PushL(plugin);
       
    69 	plugin->ConstructL();
       
    70 	CleanupStack::Pop(plugin);
       
    71 	return plugin;
       
    72 	}
       
    73 
       
    74 const TImplementationProxy ImplementationTable[] =
       
    75 	{
       
    76 	{{0x10281fe6}, ::CreatePlugin}
       
    77 	};
       
    78 
       
    79 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    80 	{
       
    81 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ;
       
    82 	return ImplementationTable;
       
    83 	}