sysresmonitoring/oommonitor/src/oomrunplugin.cpp
branchRCL_3
changeset 19 924385140d98
parent 18 0818dd463d41
child 20 c2c61fdca848
--- a/sysresmonitoring/oommonitor/src/oomrunplugin.cpp	Thu Aug 19 10:05:08 2010 +0300
+++ b/sysresmonitoring/oommonitor/src/oomrunplugin.cpp	Tue Aug 31 15:24:25 2010 +0300
@@ -21,9 +21,6 @@
 #include "oommonitorplugin.h"
 #include "oompanic.h"
 
-#include <apgtask.h>
-#include <w32std.h>
-
 COomRunPlugin* COomRunPlugin::NewL(TUint aPluginId, COomRunPluginConfig& aConfig, MOomActionObserver& aStateChangeObserver, COomMonitorPlugin& aPlugin, COomMonitorPluginV2* aV2Plugin)
     {
     FUNC_LOG;
@@ -37,40 +34,21 @@
 
 // Run the OOM plugin in order to free memory
 // Call the COomAction::MemoryFreed when it is done
-void COomRunPlugin::FreeMemory(TInt aBytesRequested, TBool aIsDataPaged)
+void COomRunPlugin::FreeMemory(TInt aBytesRequested, TBool)
     {
     FUNC_LOG;
-    iFreeMemoryCalled = ETrue;
-    
+    TRACES1("COomRunPlugin::FreeMemory: iPluginId = %x", iPluginId);        
+
+    // Ask the plugin to free some memory
+
     // Do we have a V2 plugin, if so then use it
     if (iV2Plugin)
-        {
-        //RDebug::Printf("COomRunPlugin::FreeMemory: Requesting to free the RAM iV2Plugin->FreeRam(%d) \n",aBytesRequested);
         iV2Plugin->FreeRam(aBytesRequested);
-        }
-     else if( aIsDataPaged )
-        {
-        if (IsAppDataPaged(iPlugin) )
-            {
-            //the plugins implemented by the application which are WDP enabled
-            //are notified.
-            //RDebug::Printf("COomRunPlugin::FreeMemory: Requesting to free the RAM to Data paged app \n");
-            iPlugin.FreeRam();
-            }
-        else
-            {
-            //Request is for freeing the paged memory(swap) but the App(iPlugin belongs to)   
-            //is non WDP no need to notify; as it can't free the swap memory 
-            iFreeMemoryCalled = EFalse;
-            return;
-            }
-        }
-     else
-        {
-        //Unpaged memory will be freed in case of non WDP app 
-        //RDebug::Printf("COomRunPlugin::FreeMemory: Requesting to free the RAM \n");
+    else
+        // If we only have a V1 plugin then use that
         iPlugin.FreeRam();
-        }
+    
+    iFreeMemoryCalled = ETrue;
     
     // Wait for the required time before we signal completion.
     __ASSERT_DEBUG(!iPluginWaiter->IsActive(), OomMonitorPanic(KStartingActivePluginWaiter));    
@@ -116,50 +94,3 @@
     
     iPluginWaiter = COomPluginWaiter::NewL(waitDuration, *this);
     }
-
-//-----------------------------------------------------------------------------
-// Function: IsAppDataPaged
-// Checks whether the application which implements the given 
-// COomMonitorPlugin is data paged
-//-----------------------------------------------------------------------------
-//
-TBool COomRunPlugin::IsAppDataPaged
-    ( COomMonitorPlugin& aPlugin ) const
-    {
-    FUNC_LOG;
-    /*
-    /TRACES1("COomRunPlugin::IsAppDataPaged: aPlugin.AppId() = %x ", aPlugin.AppId() );        
-    //RDebug::Printf("COomRunPlugin::IsAppDataPaged: aPlugin.AppId() = %x ", aPlugin.AppId() );
-     */
-    //the function find the process with given appid and check
-    //application supports the data paging.
-    RProcess clientprocess;    
-    TApaTaskList taskList(aPlugin.WsSession());
-    RThread clientthread; 
-    TInt err = clientthread.Open
-            (taskList.FindApp(aPlugin.AppId()).ThreadId());
-    
-    //RDebug::Printf("COomRunPlugin::IsAppDataPaged: clientthread.Open() err = %d ", err );
-    
-    if( !err )
-        {
-        //getting the process which provides the plugin
-        err = clientthread.Process(clientprocess);
-        RDebug::Printf("COomRunPlugin::IsAppDataPaged: clientthread.Process() err = %d ", err );
-        
-        if( !err )
-            {
-            //checking whether the process is Data paged or not
-            TBool isdatapaged = clientprocess.DefaultDataPaged();
-            clientprocess.Close();
-            clientthread.Close();
-            //RDebug::Printf("COomRunPlugin::IsAppDataPaged: isdatapaged = %d ", isdatapaged );
-            
-            return isdatapaged;
-            }
-        clientthread.Close();
-        }    
-    //could not successfully open the handle of process or thread, 
-    //the return EFalse 
-    return EFalse;
-    }