sysresmonitoring/oommonitor/src/oomcloseapp.cpp
branchRCL_3
changeset 82 4610cd70c542
parent 66 9af619316cbf
equal deleted inserted replaced
70:739cef680932 82:4610cd70c542
     1 /*
     1 /*
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    38     return self;
    38     return self;
    39     }
    39     }
    40 
    40 
    41 // Close the application in order to free memory
    41 // Close the application in order to free memory
    42 // Call the COomAction::MemoryFreed when it is done
    42 // Call the COomAction::MemoryFreed when it is done
    43 void COomCloseApp::FreeMemory(TInt, TBool aIsDataPaged)
    43 void COomCloseApp::FreeMemory(TInt)
    44     {
    44     {
    45     FUNC_LOG;
    45     FUNC_LOG;
    46 
    46 
    47     iAppCloserRunning = ETrue;
    47     iAppCloserRunning = ETrue;
    48     
    48     
    54     // Start a timer and the thread watcher 
    54     // Start a timer and the thread watcher 
    55     iAppCloseTimer->After(CMemoryMonitor::GlobalConfig().iMaxAppExitTime * KMicrosecondsInMillisecond);
    55     iAppCloseTimer->After(CMemoryMonitor::GlobalConfig().iMaxAppExitTime * KMicrosecondsInMillisecond);
    56     iAppCloseWatcher->Start(iCurrentTask);
    56     iAppCloseWatcher->Start(iCurrentTask);
    57     // Tell the app to close
    57     // Tell the app to close
    58     TRACES1("COomCloseApp::FreeMemory: Closing app with window group id %d",iWgId);
    58     TRACES1("COomCloseApp::FreeMemory: Closing app with window group id %d",iWgId);
    59     
    59     iCurrentTask.EndTask();
    60     RThread thread;
       
    61     TInt err=thread.Open(iCurrentTask.ThreadId());
       
    62     if (err == KErrNone)
       
    63         {
       
    64         RProcess process;
       
    65         err = thread.Process(process);
       
    66         if(err == KErrNone)
       
    67             {
       
    68             TBool isDataPaged = process.DefaultDataPaged();
       
    69             if((aIsDataPaged && isDataPaged) || (!aIsDataPaged && !isDataPaged ))
       
    70                 {
       
    71                 iCurrentTask.EndTask();
       
    72                 }                    
       
    73             process.Close();
       
    74             }
       
    75         thread.Close();
       
    76         }
       
    77     }
    60     }
    78 
    61 
    79 COomCloseApp::~COomCloseApp()
    62 COomCloseApp::~COomCloseApp()
    80     {
    63     {
    81     FUNC_LOG;
    64     FUNC_LOG;