uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
branchRCL_3
changeset 34 3a60ebea00d0
parent 22 7c5dd702d6d3
child 49 c9d868f1e20c
equal deleted inserted replaced
24:f93c875b566e 34:3a60ebea00d0
    41     {
    41     {
    42     FUNC_LOG;
    42     FUNC_LOG;
    43     }
    43     }
    44 
    44 
    45 // Update the list of window groups
    45 // Update the list of window groups
    46 void CGOomWindowGroupList::Refresh()
    46 void CGOomWindowGroupList::Refresh(TBool aOptionalOnly)
    47     {
    47     {
    48     FUNC_LOG;
    48     FUNC_LOG;
    49     
    49     
    50 #ifdef _DEBUG
    50 #ifdef _DEBUG
    51     TRAPD(err, RefreshL());
    51     TRAPD(err, RefreshL(aOptionalOnly));
    52     if (err)
    52     if (err)
    53         {
    53         {
    54         TRACES1("CGOomWindowGroupList::Refresh(): RefreshL leave %d", err);
    54         TRACES1("CGOomWindowGroupList::Refresh(): RefreshL leave %d", err);
    55         }
    55         }
    56 #else
    56 #else
    57     TRAP_IGNORE(RefreshL());
    57     TRAP_IGNORE(RefreshL(aOptionalOnly));
    58     // Ignore any error
    58     // Ignore any error
    59     // Errors are very unlikely, the only possibility is OOM errors (which should be very unlikely due to pre-created, re-reserved lists)
    59     // Errors are very unlikely, the only possibility is OOM errors (which should be very unlikely due to pre-created, re-reserved lists)
    60     // The outcome of any error is that the most foreground operations will be missing from the list
    60     // The outcome of any error is that the most foreground operations will be missing from the list
    61     // meaning that they will not be considered candidates for closing
    61     // meaning that they will not be considered candidates for closing
    62 #endif    
    62 #endif    
    63     }
    63     }
    64 
    64 
    65 // Update the list of window groups
    65 // Update the list of window groups
    66 // Should be called whenever the 
    66 // Should be called whenever the 
    67 void CGOomWindowGroupList::RefreshL()
    67 void CGOomWindowGroupList::RefreshL(TBool aOptionalOnly)
    68     {
    68     {
    69     FUNC_LOG;
    69     FUNC_LOG;
    70   
    70   
    71     if (!iAlfClient.Handle())
    71     if (!iAlfClient.Handle())
    72         {
    72         {
    74         }
    74         }
    75     iLowOnMemWgs.Reset();
    75     iLowOnMemWgs.Reset();
    76     RArray<TInt> inactiveSurfaces;
    76     RArray<TInt> inactiveSurfaces;
    77 
    77 
    78     // ignore possible errors, we have information from profiling extension anyway
    78     // ignore possible errors, we have information from profiling extension anyway
    79     iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
    79     if (!aOptionalOnly)
    80     iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
    80         {
    81         
    81         iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
       
    82         iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
       
    83         }
       
    84     else
       
    85         { // first iteration: try to cope with window group ID's only
       
    86           // Most likely that needs to be revisited because apps fail to name their window 
       
    87           // groups properly on external screens...  
       
    88         iAlfClient.GetOptionalGraphicsMemUsers(&inactiveSurfaces);    
       
    89         iOptionalUids.Reset();
       
    90         TInt count = inactiveSurfaces.Count(); 
       
    91         for (TInt i = 0; i<count-1; i++)
       
    92             {
       
    93             iOptionalUids.Append(inactiveSurfaces[i+1]);
       
    94             inactiveSurfaces.Remove(i+1);
       
    95             count--;
       
    96             }   
       
    97         }
       
    98         
       
    99     TRACES1("Optional list composed: %d", aOptionalOnly);     
    82     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
   100     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
    83     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
   101     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
    84 
   102 
    85     RArray<TUint64> processIds;
   103     RArray<TUint64> processIds;
    86     RArray<TUint> privMemUsed;
   104     RArray<TUint> privMemUsed;
    87     RArray<TUint64> sparedProcessIds;
   105     RArray<TUint64> sparedProcessIds;
    88     
   106     
    89    //if (inactiveSurfaces.Count() == 1) // ALF only 
   107    if (!aOptionalOnly)
    90    //     {
   108       {
    91     NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
   109       NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
    92     
   110     
    93     if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
   111       if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
    94         {
   112         {
    95         TRACES("RefreshL EGL_NOK_resource_profiling not available");
   113         TRACES("RefreshL EGL_NOK_resource_profiling not available");
    96         return;
   114         return;
    97         }
   115         }
    98     
   116     
    99     if (eglQueryProfilingData)
   117      if (eglQueryProfilingData)
   100         {
   118         {
   101         EGLint data_count;
   119         EGLint data_count;
   102         EGLint* prof_data;
   120         EGLint* prof_data;
   103         TInt i(0);
   121         TInt i(0);
   104         
   122         
   204                     return;
   222                     return;
   205                     }
   223                     }
   206                 }
   224                 }
   207             }
   225             }
   208         }
   226         }
   209                 
   227       }            
   210     // Refresh window group list
   228     // Refresh window group list
   211     // get all window groups, with info about parents
   229     // get all window groups, with info about parents
   212     TInt numGroups = iWs.NumWindowGroups();
   230     TInt numGroups = iWs.NumWindowGroups();
   213     iWgIds.ReserveL(numGroups);
   231     iWgIds.ReserveL(numGroups);
   214     User::LeaveIfError(iWs.WindowGroupList(&iWgIds));
   232     User::LeaveIfError(iWs.WindowGroupList(&iWgIds));