uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
changeset 53 5ba07f7750a9
parent 46 180438f24a1e
child 60 5dafecb0892a
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Mon Aug 02 12:09:20 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Thu Sep 02 13:30:25 2010 +0300
@@ -337,7 +337,7 @@
     
     }
 
-void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode)
+void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode, TBool aForced)
     {
     if(iMemMode == aMemMode)
         {
@@ -357,10 +357,13 @@
  
     if(aMemMode == EGOomLowMemMode)
         {
-        if(iRendswitched < 3)
-            iRendswitched ++;
-        else
-            return;
+        if(!aForced)
+            {
+            if(iRendswitched < 3)
+                iRendswitched ++;
+            else
+                return;
+            }
         
         iLowOnMemWgs.Reset();
         iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs);
@@ -369,14 +372,17 @@
         }
     else
         {
-        if(iRendswitched > 0)
+        if(!aForced)
             {
-            if(iRendswitched < 3)
-                iRendswitched ++;
-            else
+            if(iRendswitched > 0)
                 {
-                TRACES("CMemoryMonitor::SwitchMemMode GOOM Detected SW-HW-SW looping. NOT switching to HW rendering mode");
-                return;
+                if(iRendswitched < 3)
+                    iRendswitched ++;
+                else
+                    {
+                    TRACES("CMemoryMonitor::SwitchMemMode GOOM Detected SW-HW-SW looping. NOT switching to HW rendering mode");
+                    return;
+                    }
                 }
             }
     
@@ -730,7 +736,7 @@
     return totalMem - totalUsed;
     }
 
-void CMemoryMonitor::DoPostponedMemoryGood()
+TBool CMemoryMonitor::DoPostponedMemoryGood()
     {
     FUNC_LOG;
     TInt current = GetFreeMemory();
@@ -740,6 +746,7 @@
             {
             TRACES2("DoPostponedMemoryGood calling MemoryGOOD current %d, iGoodThreshold %d",current, iGoodThreshold);
             iGOomActionList->MemoryGood();
+            return ETrue;
             }
         else
             {
@@ -750,8 +757,23 @@
         {
         iMemAllocationsGoingDown->Continue();
         }   
+    return EFalse;
     }    
 
+TBool CMemoryMonitor::SwitchRenderingToHW()
+    {
+    FUNC_LOG;
+    TInt current = GetFreeMemory();
+    if(current >= iGoodThreshold)
+        {
+        SwitchMemMode(EGOomGoodMemMode, ETrue);
+        iMemAllocationsGrowing->Continue();
+        return ETrue;
+        }
+    return EFalse;
+    }    
+
+
 void CMemoryMonitor::AppClosePriorityChanged(TInt aWgId, TInt aPriority)
     {
     FUNC_LOG;