uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp
branchRCL_3
changeset 17 c9d868f1e20c
parent 15 cd0ae4656946
child 18 1801340c26a2
equal deleted inserted replaced
15:cd0ae4656946 17:c9d868f1e20c
    42 // Call the CGOomAction::MemoryFreed when it is done
    42 // Call the CGOomAction::MemoryFreed when it is done
    43 void CGOomCloseApp::FreeMemory(TInt, TBool)
    43 void CGOomCloseApp::FreeMemory(TInt, TBool)
    44     {
    44     {
    45     FUNC_LOG;
    45     FUNC_LOG;
    46 
    46 
    47     if ( iAlreadyGaveUp )
    47     if ( iAlreadyGaveUp )	//will this ever be true ??? iAlredyGaveup is set true in closeAppEvent, which is called only if app gets notified by goom, which happens only after this
    48         {
    48         {
    49         if (iAppCloseTimer)
    49         if (iAppCloseTimer)
    50         	{
    50         	{
    51 			iAppCloseTimer->Cancel();
    51 			iAppCloseTimer->Cancel();
    52     		}
    52     		}
    63 
    63 
    64     iAppCloserRunning = ETrue;
    64     iAppCloserRunning = ETrue;
    65     
    65     
    66     // Set the TApaTask to the app
    66     // Set the TApaTask to the app
    67     iCurrentTask.SetWgId(iWgId);
    67     iCurrentTask.SetWgId(iWgId);
    68 
    68     
    69     // start the chain
    69     // Start a timer and the thread watcher 
    70     ConditionalClose();
    70     /*
       
    71 	iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing);
       
    72     iAppCloseTimer->After(iCloseTimeout * 1000);
       
    73     iAppCloseWatcher->Start(iCurrentTask);
       
    74     // Tell the app to close
       
    75     TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout);
       
    76     iCurrentTask.EndTask();
       
    77 	*/
       
    78 	ConditionalClose();
    71     }
    79     }
    72 
    80 
    73 CGOomCloseApp::~CGOomCloseApp()
    81 CGOomCloseApp::~CGOomCloseApp()
    74     {
    82     {
    75     FUNC_LOG;
    83     FUNC_LOG;
   143     {
   151     {
   144     FUNC_LOG;
   152     FUNC_LOG;
   145     // Start a timer and the thread watcher 
   153     // Start a timer and the thread watcher 
   146     iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing);
   154     iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing);
   147     iAppCloseTimer->After(iCloseTimeout * 1000);
   155     iAppCloseTimer->After(iCloseTimeout * 1000);
       
   156     iAppCloseWatcher->Start(iCurrentTask);
   148     // Tell the app to close
   157     // Tell the app to close
   149 	// We are not asking system applications to exit anyway, so we'll send legacy event only
   158 	// We are not asking system applications to exit anyway, so we'll send legacy event only
   150 	// even we have powermgmt capability 
   159 	// even we have powermgmt capability 
   151     TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout);
   160     TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout);
   152 	TWsEvent event;
   161 	TWsEvent event;
   174         {
   183         {
   175         iAppCloseWatcher->Cancel(); 
   184         iAppCloseWatcher->Cancel(); 
   176         }
   185         }
   177         
   186         
   178     if(IsConsumingMemory(iWgId))    
   187     if(IsConsumingMemory(iWgId))    
   179         {    
   188         {
       
   189         TRACES1("REST IN PEACE - App wgid %d", iWgId);
   180         iCurrentTask.KillTask();
   190         iCurrentTask.KillTask();
   181         iAppCloserRunning = EFalse; // not sure if intended (?)
   191         iAppCloserRunning = EFalse; // not sure if intended (?)
   182         iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
   192         iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
   183         iAppCloseTimer->After(iWaitAfterClose * 1000);
   193         iAppCloseTimer->After(iWaitAfterClose * 1000);
   184         }
   194         }
   185     else
   195     else
   186         { // application has released its graphics resources -> we are no more interested about it
   196         { // application has released its graphics resources -> we are no more interested about it
   187         CloseAppEvent();
   197         //CloseAppEvent();
       
   198         iAppCloserRunning = EFalse; 
       
   199         MemoryFreed(KErrNone);
   188         }    
   200         }    
   189     //MemoryFreed(KErrNone);
       
   190     }
   201     }
   191 
   202 
   192 void CGOomCloseApp::KillTaskWaitDone()
   203 void CGOomCloseApp::KillTaskWaitDone()
   193     {
   204     {
   194     FUNC_LOG;
   205     FUNC_LOG;