uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h
branchRCL_3
changeset 17 c9d868f1e20c
parent 15 cd0ae4656946
equal deleted inserted replaced
15:cd0ae4656946 17:c9d868f1e20c
    24 #include <w32std.h>
    24 #include <w32std.h>
    25 #include <EGL/egl.h>
    25 #include <EGL/egl.h>
    26 #include "goomglobalconfig.h"
    26 #include "goomglobalconfig.h"
    27 #include "goomwindowgrouplist.h"
    27 #include "goomwindowgrouplist.h"
    28 #include "goomtraces.h"
    28 #include "goomtraces.h"
       
    29 
       
    30 #define ALWAYS_SW_REND 0	//enable only for testing purpose - will force sw rendering no matter what
    29 
    31 
    30 // ---------------------------------------------------------
    32 // ---------------------------------------------------------
    31 // CMemoryMonitor
    33 // CMemoryMonitor
    32 // ---------------------------------------------------------
    34 // ---------------------------------------------------------
    33 //
    35 //
    54             EGOomTriggerNone = 0,
    56             EGOomTriggerNone = 0,
    55             EGOomTriggerFocusChanged,
    57             EGOomTriggerFocusChanged,
    56             EGOomTriggerRequestMemory,
    58             EGOomTriggerRequestMemory,
    57             EGOomTriggerThresholdCrossed
    59             EGOomTriggerThresholdCrossed
    58             };
    60             };
       
    61     
       
    62     enum TGOomMemMode
       
    63         {
       
    64         EGOomGoodMemMode = 0,
       
    65         EGOomLowMemMode
       
    66         };
    59 
    67 
    60 public: // event handlers
    68 public: // event handlers
    61     void FreeMemThresholdCrossedL(TInt aAction = 0, TInt aThreshold = 0);
    69     void FreeMemThresholdCrossedL(TInt aAction = 0, TInt aThreshold = 0);
    62     void AppNotExiting(TInt aWgId);
    70     void AppNotExiting(TInt aWgId);
    63     void StartFreeSomeRamL(TInt aTargetFree, TGOomTrigger aTrigger);
    71     void StartFreeSomeRamL(TInt aTargetFree, TGOomTrigger aTrigger);
   100             
   108             
   101             TRACES2("SessionInCriticalAllocation : STARTING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
   109             TRACES2("SessionInCriticalAllocation : STARTING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
   102             }
   110             }
   103         else
   111         else
   104             {
   112             {
       
   113             if(aClientId == 0)
       
   114                 {
       
   115                 iClientsRequestingMemory.Reset();
       
   116                 }
       
   117             
   105             TInt idx = iClientsRequestingMemory.Find(aClientId);
   118             TInt idx = iClientsRequestingMemory.Find(aClientId);
   106             if(idx != KErrNotFound)
   119             if(idx != KErrNotFound)
   107                 {
   120                 {
   108                 iClientsRequestingMemory.Remove(idx);
   121                 iClientsRequestingMemory.Remove(idx);
   109                 TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
   122                 TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
   125         } 
   138         } 
   126     
   139     
   127     void WaitAndSynchroniseMemoryState();
   140     void WaitAndSynchroniseMemoryState();
   128     void SynchroniseMemoryState();
   141     void SynchroniseMemoryState();
   129     
   142     
       
   143     void SwitchMemMode(TGOomMemMode aMemMode);
       
   144     
   130 private:
   145 private:
   131     CMemoryMonitor();
   146     CMemoryMonitor();
   132     void ConstructL();
   147     void ConstructL();
   133     TBool FreeGraphicsMemoryAboveThresholdL(TInt& aCurrentFreeMemory);
   148     TBool FreeGraphicsMemoryAboveThresholdL(TInt& aCurrentFreeMemory);
   134     void CloseNextApp();
   149     void CloseNextApp();
   199     RArray<TUint> iClientsRequestingMemory;
   214     RArray<TUint> iClientsRequestingMemory;
   200     
   215     
   201     TGOomTrigger iTrigger;
   216     TGOomTrigger iTrigger;
   202     
   217     
   203     CGOomSynchTimer* iSynchTimer;
   218     CGOomSynchTimer* iSynchTimer;
       
   219     
       
   220     TBool iMemMode;
       
   221     TBool iForegroundAppHasChanged;
       
   222     
       
   223     TInt iRendswitched;
       
   224     
       
   225     RArray<TInt> iLowOnMemWgs;
   204     };
   226     };
   205 
   227 
   206 
   228 
   207 
   229 
   208 NONSHARABLE_CLASS(CGOomSynchTimer) : public CTimer
   230 NONSHARABLE_CLASS(CGOomSynchTimer) : public CTimer