uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
branchRCL_3
changeset 13 3a60ebea00d0
parent 10 7c5dd702d6d3
child 17 c9d868f1e20c
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -43,18 +43,18 @@
     }
 
 // Update the list of window groups
-void CGOomWindowGroupList::Refresh()
+void CGOomWindowGroupList::Refresh(TBool aOptionalOnly)
     {
     FUNC_LOG;
     
 #ifdef _DEBUG
-    TRAPD(err, RefreshL());
+    TRAPD(err, RefreshL(aOptionalOnly));
     if (err)
         {
         TRACES1("CGOomWindowGroupList::Refresh(): RefreshL leave %d", err);
         }
 #else
-    TRAP_IGNORE(RefreshL());
+    TRAP_IGNORE(RefreshL(aOptionalOnly));
     // Ignore any error
     // Errors are very unlikely, the only possibility is OOM errors (which should be very unlikely due to pre-created, re-reserved lists)
     // The outcome of any error is that the most foreground operations will be missing from the list
@@ -64,7 +64,7 @@
 
 // Update the list of window groups
 // Should be called whenever the 
-void CGOomWindowGroupList::RefreshL()
+void CGOomWindowGroupList::RefreshL(TBool aOptionalOnly)
     {
     FUNC_LOG;
   
@@ -76,9 +76,27 @@
     RArray<TInt> inactiveSurfaces;
 
     // ignore possible errors, we have information from profiling extension anyway
-    iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
-    iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+    if (!aOptionalOnly)
+        {
+        iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
+        iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+        }
+    else
+        { // first iteration: try to cope with window group ID's only
+          // Most likely that needs to be revisited because apps fail to name their window 
+          // groups properly on external screens...  
+        iAlfClient.GetOptionalGraphicsMemUsers(&inactiveSurfaces);    
+        iOptionalUids.Reset();
+        TInt count = inactiveSurfaces.Count(); 
+        for (TInt i = 0; i<count-1; i++)
+            {
+            iOptionalUids.Append(inactiveSurfaces[i+1]);
+            inactiveSurfaces.Remove(i+1);
+            count--;
+            }   
+        }
         
+    TRACES1("Optional list composed: %d", aOptionalOnly);     
     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
 
@@ -86,17 +104,17 @@
     RArray<TUint> privMemUsed;
     RArray<TUint64> sparedProcessIds;
     
-   //if (inactiveSurfaces.Count() == 1) // ALF only 
-   //     {
-    NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+   if (!aOptionalOnly)
+      {
+      NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
     
-    if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
+      if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
         {
         TRACES("RefreshL EGL_NOK_resource_profiling not available");
         return;
         }
     
-    if (eglQueryProfilingData)
+     if (eglQueryProfilingData)
         {
         EGLint data_count;
         EGLint* prof_data;
@@ -206,7 +224,7 @@
                 }
             }
         }
-                
+      }            
     // Refresh window group list
     // get all window groups, with info about parents
     TInt numGroups = iWs.NumWindowGroups();