uiacceltk/hitchcock/goommonitor/src/goomthresholdcrossedao.inl
changeset 60 5dafecb0892a
parent 0 15bf7259bb7c
--- a/uiacceltk/hitchcock/goommonitor/src/goomthresholdcrossedao.inl	Tue Sep 28 14:40:28 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomthresholdcrossedao.inl	Thu Oct 14 18:35:08 2010 +0300
@@ -30,13 +30,14 @@
 NONSHARABLE_CLASS(CGoomThresholdCrossed): public CActive
     {
     public:
-    CGoomThresholdCrossed(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold)
+    CGoomThresholdCrossed(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold, TInt aTotalMem)
         :CActive(CActive::EPriorityHigh), 
         iMarkerState(KErrNotFound),
         iActiveThreshold(aThreshold),
         iAction(aAction),
         iThread(RThread().Id()),
-        iMonitor(aMonitor)
+        iMonitor(aMonitor),
+        iTotalMem(aTotalMem)
         {
         FUNC_LOG;
         CActiveScheduler::Add(this);
@@ -145,12 +146,12 @@
             {
             iStop.Wait();
             iStop.Signal();
-            TUint usedThreshold = Min(iActiveThreshold,32*1024*1024) ;
+            TUint usedThreshold = Min(iActiveThreshold,iTotalMem) ;
             TUint action = iAction;
             const EGLint sync_attribs[] =
                 {
                 EGL_SYNC_CONDITION_KHR,              action,
-                EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK, 32*1024*1024-usedThreshold,
+                EGL_PROF_MEMORY_USAGE_THRESHOLD_NOK, iTotalMem-usedThreshold,
                 EGL_NONE
                 };
 
@@ -283,6 +284,7 @@
     EGLDisplay iDpy;
     TBool iPaused;
     RCriticalSection iStop;
+    TInt iTotalMem;
     };
 
 // ---------------------------------------------------------------------------
@@ -306,10 +308,10 @@
     return err;
     }
 
-CGoomThresholdCrossed* CreateThresholdCrossedThreadL(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold)
+CGoomThresholdCrossed* CreateThresholdCrossedThreadL(CMemoryMonitor& aMonitor, TUint aAction, TInt aThreshold, TInt aTotalMem)
     {
     FUNC_LOG;
-    CGoomThresholdCrossed* ao = new (ELeave) CGoomThresholdCrossed(aMonitor, aAction, aThreshold);
+    CGoomThresholdCrossed* ao = new (ELeave) CGoomThresholdCrossed(aMonitor, aAction, aThreshold, aTotalMem);
     CleanupStack::PushL(ao);
     RThread syncThread;