uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp
changeset 19 f5bac0badc7e
parent 13 8f67d927ea57
child 46 180438f24a1e
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
    34     return self;
    34     return self;
    35     }
    35     }
    36 
    36 
    37 // Run the GOOM plugin in order to free memory
    37 // Run the GOOM plugin in order to free memory
    38 // Call the CGOomAction::MemoryFreed when it is done
    38 // Call the CGOomAction::MemoryFreed when it is done
    39 void CGOomRunPlugin::FreeMemory(TInt aBytesRequested)
    39 void CGOomRunPlugin::FreeMemory(TInt aBytesRequested, TBool aUseSwRendering)
    40     {
    40     {
    41     FUNC_LOG;
    41     FUNC_LOG;
    42     TRACES1("CGOomRunPlugin::FreeMemory: iPluginId = 0x%x", iPluginId);
    42     TRACES1("CGOomRunPlugin::FreeMemory: iPluginId = 0x%x", iPluginId);
    43     TRACES1("CGOomRunPlugin::FreeMemory: aBytesRequested = %d", aBytesRequested);
    43     TRACES1("CGOomRunPlugin::FreeMemory: aBytesRequested = %d", aBytesRequested);
    44 
    44 
    45     // Ask the plugin to free some memory, should actually ask the difference 
    45     // Ask the plugin to free some memory, should actually ask the difference 
    46     // between existing and required amount..
    46     // between existing and required amount..
    47     TInt clientId = iStateChangeObserver.ClientId();
    47     TInt clientId = iStateChangeObserver.ClientId();
    48     TAny* anyp = (TAny*) &clientId;
    48     TAny* anyp = (TAny*) &clientId;
    49     iPlugin.ExtensionInterface(TUid::Uid(KGoomClientSecureId), anyp);
    49     iPlugin.ExtensionInterface(TUid::Uid(KGoomClientSecureId), anyp);
    50     iPlugin.FreeRam(aBytesRequested);
    50     
       
    51     if(aUseSwRendering && iConfig.IsSwRendSupported())
       
    52         {
       
    53 		TInt flags = KGOomUseSwRendering;
       
    54         iPlugin.FreeRam(aBytesRequested, flags);
       
    55         iFreeMemoryWithSwRenderingCalled = ETrue;
       
    56         }
       
    57     else
       
    58         {
       
    59         iPlugin.FreeRam(aBytesRequested, 0);
       
    60         }
    51 
    61 
    52     iFreeMemoryCalled = ETrue;
    62     iFreeMemoryCalled = ETrue;
    53 
    63 
    54     // Wait for the required time before we signal completion.
    64     // Wait for the required time before we signal completion.
    55     iPluginWaiter->Start();
    65     if(iPluginWaiter)
       
    66         {
       
    67         iPluginWaiter->Start();
       
    68         }
    56     }
    69     }
    57 
    70 
    58 // Call the memory good function on the plugin but...
    71 // Call the memory good function on the plugin but...
    59 // only if there is an outstanding FreeMemory request
    72 // only if there is an outstanding FreeMemory request
    60 void CGOomRunPlugin::MemoryGood()
    73 void CGOomRunPlugin::MemoryGood()
    61     {
    74     {
    62     FUNC_LOG;
    75     FUNC_LOG;
    63 
    76 
    64     if (iFreeMemoryCalled)
    77     if (iFreeMemoryCalled)
    65         {
    78         {
    66         iPlugin.MemoryGood();
    79 		TInt flags = 0;
       
    80 		if(iFreeMemoryWithSwRenderingCalled)
       
    81 			flags = KGOomUseSwRendering;
       
    82         iPlugin.MemoryGood(flags);
    67         iFreeMemoryCalled = EFalse;
    83         iFreeMemoryCalled = EFalse;
       
    84         iFreeMemoryWithSwRenderingCalled = EFalse;
    68         }
    85         }
    69     }
    86     }
    70 
    87 
    71 CGOomRunPlugin::~CGOomRunPlugin()
    88 CGOomRunPlugin::~CGOomRunPlugin()
    72     {
    89     {
    84     {
   101     {
    85     FUNC_LOG;
   102     FUNC_LOG;
    86 
   103 
    87     TInt waitDuration = CMemoryMonitor::GlobalConfig().iDefaultWaitAfterPlugin;
   104     TInt waitDuration = CMemoryMonitor::GlobalConfig().iDefaultWaitAfterPlugin;
    88 
   105 
    89     if (aPluginConfig.WaitAfterPluginDefined())
   106     if(aPluginConfig.iSyncMode == ECheckRam)
    90         {
   107         {
    91         // If the wait duration for this plugin is overridden then use the overridden value
   108         if (aPluginConfig.WaitAfterPluginDefined())
    92         waitDuration = aPluginConfig.WaitAfterPlugin();
   109             {
       
   110             // If the wait duration for this plugin is overridden then use the overridden value
       
   111             waitDuration = aPluginConfig.WaitAfterPlugin();
       
   112             }
       
   113          iPluginWaiter = CGOomPluginWaiter::NewL(waitDuration, *this);
    93         }
   114         }
    94 
       
    95     iPluginWaiter = CGOomPluginWaiter::NewL(waitDuration, *this);
       
    96     }
   115     }
    97 
   116 
    98 TUint CGOomRunPlugin::Id()
   117 TUint CGOomRunPlugin::Id()
    99     {
   118     {
   100     return iPluginId;
   119     return iPluginId;