uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h
changeset 43 95d73125a086
parent 13 8f67d927ea57
child 53 5ba07f7750a9
--- a/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h	Wed Jun 23 19:14:05 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h	Tue Jul 06 15:18:10 2010 +0300
@@ -27,6 +27,8 @@
 #include "goomwindowgrouplist.h"
 #include "goomtraces.h"
 
+#define ALWAYS_SW_REND 0	//enable only for testing purpose - will force sw rendering no matter what
+
 // ---------------------------------------------------------
 // CMemoryMonitor
 // ---------------------------------------------------------
@@ -56,6 +58,12 @@
             EGOomTriggerRequestMemory,
             EGOomTriggerThresholdCrossed
             };
+    
+    enum TGOomMemMode
+        {
+        EGOomGoodMemMode = 0,
+        EGOomLowMemMode
+        };
 
 public: // event handlers
     void FreeMemThresholdCrossedL(TInt aAction = 0, TInt aThreshold = 0);
@@ -91,9 +99,10 @@
     void SessionInCriticalAllocation(TBool aPostponeMemGood, TUint aClientId)
         {
         FUNC_LOG;
+        TInt oldCount = iClientsRequestingMemory.Count();
+        
         if (aPostponeMemGood)
             {
-            iPostponeMemGood++;
             if(iClientsRequestingMemory.Find(aClientId) == KErrNotFound)
                 iClientsRequestingMemory.Append(aClientId);
             
@@ -101,21 +110,20 @@
             }
         else
             {
-            iPostponeMemGood--;
+            if(aClientId == 0)
+                {
+                iClientsRequestingMemory.Reset();
+                }
+            
             TInt idx = iClientsRequestingMemory.Find(aClientId);
             if(idx != KErrNotFound)
                 {
                 iClientsRequestingMemory.Remove(idx);
                 TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
                 }
-            
-             if(iPostponeMemGood<0)
-                {
-                iPostponeMemGood = 0;
-                }
             }
         TRACES1("SessionInCriticalAllocation : ClientsRequestingMemory Count %d", iClientsRequestingMemory.Count());    
-        if (iClientsRequestingMemory.Count() == 0)
+        if (oldCount && iClientsRequestingMemory.Count() == 0)
             {
             DoPostponedMemoryGood();
             }
@@ -126,13 +134,14 @@
     
     TBool NeedToPostponeMemGood()
         {
-        //return (iPostponeMemGood != 0);
         return (iClientsRequestingMemory.Count() != 0);
         } 
     
     void WaitAndSynchroniseMemoryState();
     void SynchroniseMemoryState();
     
+    void SwitchMemMode(TGOomMemMode aMemMode);
+    
 private:
     CMemoryMonitor();
     void ConstructL();
@@ -201,13 +210,19 @@
     CGoomThresholdCrossed* iMemAllocationsGoingDown;
     
     TInt iForegroundAppUid;
-    TInt iPostponeMemGood;
     
     RArray<TUint> iClientsRequestingMemory;
     
     TGOomTrigger iTrigger;
     
     CGOomSynchTimer* iSynchTimer;
+    
+    TBool iMemMode;
+    TBool iForegroundAppHasChanged;
+    
+    TInt iRendswitched;
+    
+    RArray<TInt> iLowOnMemWgs;
     };