uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
changeset 14 83d2d132aa58
parent 13 8f67d927ea57
child 19 f5bac0badc7e
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -219,6 +219,14 @@
     
     aWindowGroupList.RefreshL();
     
+    for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
+        {
+        if ( iLowOnMemWgs.Find(aWindowGroupList.LowOnMemWgs(i)) == KErrNotFound)
+            {
+            iLowOnMemWgs.Append(aWindowGroupList.LowOnMemWgs(i));    
+            }
+        }
+        
     iRunningKillAppActions = ETrue;
     
     if (aWindowGroupList.Count())
@@ -316,7 +324,7 @@
 
     if (iFreeingMemory)
             {
-            TRACES("OOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
+            TRACES("GOOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
             return;
             }
     
@@ -331,6 +339,8 @@
 
     TInt memoryEstimate = iMonitor.GetFreeMemory(); // The amount of free memory we expect to be free after the currently initiated operations
 
+    TRACES2("GOOMWATCHER:CGOomActionList::FreeMemory Memory currentActionIndex %d iActionrefsCount %d", iCurrentActionIndex, iActionRefs.Count());
+    
     while (iCurrentActionIndex < iActionRefs.Count())
         {
         if(iActionRefs[iCurrentActionIndex].Priority() > aMaxPriority)
@@ -352,6 +362,8 @@
             
             TInt32 fgApp = wgName->AppUid().iUid;
             TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue);
+            
+            CleanupStack::PopAndDestroy();
             if(appId == fgApp)
                 {
                 TRACES1("Foreground App wgid %x, spared by GOOM", appId);
@@ -396,6 +408,7 @@
             // Also check if we estimate that we have already freed enough memory (assuming that the sync mode is "estimate"
             {
             // Return from the loop - we will be called back (in CGOomActionList::StateChanged()) when the running actions complete
+            iCurrentActionIndex++;
             TRACES("CGOomActionList::FreeMemory: Exiting run action loop");
             return;
             }
@@ -433,6 +446,17 @@
             iActionRefs[actionRefIndex].RunPlugin().MemoryGood();
             }
         }
+    // notify window groups which were triggered to low mem that 
+    TWsEvent event;
+    event.SetType(KGoomMemoryGoodEvent); // naive
+
+    for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
+        {
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event);
+#endif // #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        iLowOnMemWgs.Remove(i);
+		}    
     }
 
 TBool CGOomActionList::FreeMemoryAboveTarget(TInt& aFreeMemory)
@@ -591,7 +615,6 @@
             {            
             TRACES2("CGOomActionList::StateChanged: Finished Action %d out of %d",iCurrentActionIndex, iActionRefs.Count());
             
-            iCurrentActionIndex++;
             
             if (iCurrentActionIndex >= iActionRefs.Count())
                 {