sysresmonitoring/oommonitor/src/oomcloseapp.cpp
branchRCL_3
changeset 18 0818dd463d41
parent 1 0fdb7f6b0309
child 19 924385140d98
equal deleted inserted replaced
17:5e7d68cc22e0 18:0818dd463d41
     1 /*
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2006-2010 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)
    43 void COomCloseApp::FreeMemory(TInt, TBool aIsDataPaged)
    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     iCurrentTask.EndTask();
    59     
       
    60     RThread thread;
       
    61     TInt err=thread.Open(iCurrentTask.ThreadId());
       
    62     if (err == KErrNone)
       
    63         {
       
    64         RProcess process;
       
    65         thread.Process(process);
       
    66         TBool isDataPaged = process.DefaultDataPaged();
       
    67         if((aIsDataPaged && isDataPaged) || (!aIsDataPaged && !isDataPaged ))
       
    68             {
       
    69             iCurrentTask.EndTask();
       
    70             }
       
    71         }
    60     }
    72     }
    61 
    73 
    62 COomCloseApp::~COomCloseApp()
    74 COomCloseApp::~COomCloseApp()
    63     {
    75     {
    64     FUNC_LOG;
    76     FUNC_LOG;