sysresmonitoring/oommonitor/src/oommemorymonitorsession.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".
    58     return ClientRequestQueue().Monitor();
    58     return ClientRequestQueue().Monitor();
    59 #else
    59 #else
    60     return Server().Monitor();    
    60     return Server().Monitor();    
    61 #endif
    61 #endif
    62     }
    62     }
    63 #ifndef CLIENT_REQUEST_QUEUE
       
    64 TBool CMemoryMonitorSession::IsDataPaged(const RMessage2& aMessage)
       
    65     {
       
    66     RThread clientThread;
       
    67     TInt err = aMessage.Client(clientThread);
       
    68     TBool dataPaged = EFalse;
       
    69     if(err == KErrNone)
       
    70         {
       
    71         RProcess processName;
       
    72         err = clientThread.Process(processName);
       
    73         if(err == KErrNone)
       
    74             {
       
    75             dataPaged = processName.DefaultDataPaged();
       
    76             processName.Close();
       
    77             clientThread.Close();
       
    78             }
       
    79         else
       
    80             {
       
    81             clientThread.Close();                        
       
    82             PanicClient(aMessage, EPanicIllegalFunction);
       
    83             }
       
    84         }
       
    85     else
       
    86         {
       
    87         PanicClient(aMessage, EPanicIllegalFunction);
       
    88         }
       
    89     return dataPaged;            
       
    90     }
       
    91 #endif
       
    92 
    63 
    93 void CMemoryMonitorSession::ServiceL(const RMessage2& aMessage)
    64 void CMemoryMonitorSession::ServiceL(const RMessage2& aMessage)
    94     {
    65     {
    95     FUNC_LOG;
    66     FUNC_LOG;
    96         
    67         
   106             // message will be completed when CloseAppsFinished() is called.
    77             // message will be completed when CloseAppsFinished() is called.
   107 #ifdef CLIENT_REQUEST_QUEUE
    78 #ifdef CLIENT_REQUEST_QUEUE
   108             ClientRequestQueue().RequestFreeMemoryL(aMessage);
    79             ClientRequestQueue().RequestFreeMemoryL(aMessage);
   109 #else
    80 #else
   110             iRequestFreeRam = aMessage;
    81             iRequestFreeRam = aMessage;
   111             Monitor().RequestFreeMemoryL(aMessage.Int0(), IsDataPaged(aMessage));
    82             Monitor().RequestFreeMemoryL(aMessage.Int0());
   112 #endif
    83 #endif
   113             break;
    84             break;
   114 
    85 
   115         case EOomMonitorCancelRequestFreeMemory:
    86         case EOomMonitorCancelRequestFreeMemory:
   116             if (!iRequestFreeRam.IsNull())
    87             if (!iRequestFreeRam.IsNull())
   130 #ifdef CLIENT_REQUEST_QUEUE
   101 #ifdef CLIENT_REQUEST_QUEUE
   131             ClientRequestQueue().RequestOptionalRamL(aMessage);
   102             ClientRequestQueue().RequestOptionalRamL(aMessage);
   132 #else
   103 #else
   133             iRequestFreeRam = aMessage;
   104             iRequestFreeRam = aMessage;
   134             iMinimumMemoryRequested = aMessage.Int1();
   105             iMinimumMemoryRequested = aMessage.Int1();
   135             Monitor().FreeOptionalRamL(aMessage.Int0(), aMessage.Int2(), IsDataPaged(aMessage));
   106             Monitor().FreeOptionalRamL(aMessage.Int0(), aMessage.Int2());
   136 #endif            
   107 #endif            
   137             break;
   108             break;
   138             
   109             
   139         case EOomMonitorSetPriorityBusy:
   110         case EOomMonitorSetPriorityBusy:
   140             Monitor().SetPriorityBusy(aMessage.Int0());
   111             Monitor().SetPriorityBusy(aMessage.Int0());