sysresmonitoring/oommonitor/src/oommemorymonitorsession.cpp
branchRCL_3
changeset 18 0818dd463d41
parent 2 7645e9ce10dc
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".
    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             }
       
    77         else
       
    78             {
       
    79             PanicClient(aMessage, EPanicIllegalFunction);
       
    80             }
       
    81         }
       
    82     else
       
    83         {
       
    84         PanicClient(aMessage, EPanicIllegalFunction);
       
    85         }
       
    86     return dataPaged;            
       
    87     }
       
    88 #endif
    63 
    89 
    64 void CMemoryMonitorSession::ServiceL(const RMessage2& aMessage)
    90 void CMemoryMonitorSession::ServiceL(const RMessage2& aMessage)
    65     {
    91     {
    66     FUNC_LOG;
    92     FUNC_LOG;
    67         
    93         
    77             // message will be completed when CloseAppsFinished() is called.
   103             // message will be completed when CloseAppsFinished() is called.
    78 #ifdef CLIENT_REQUEST_QUEUE
   104 #ifdef CLIENT_REQUEST_QUEUE
    79             ClientRequestQueue().RequestFreeMemoryL(aMessage);
   105             ClientRequestQueue().RequestFreeMemoryL(aMessage);
    80 #else
   106 #else
    81             iRequestFreeRam = aMessage;
   107             iRequestFreeRam = aMessage;
    82             Monitor().RequestFreeMemoryL(aMessage.Int0());
   108             Monitor().RequestFreeMemoryL(aMessage.Int0(), IsDataPaged(aMessage));
    83 #endif
   109 #endif
    84             break;
   110             break;
    85 
   111 
    86         case EOomMonitorCancelRequestFreeMemory:
   112         case EOomMonitorCancelRequestFreeMemory:
    87             if (!iRequestFreeRam.IsNull())
   113             if (!iRequestFreeRam.IsNull())
   101 #ifdef CLIENT_REQUEST_QUEUE
   127 #ifdef CLIENT_REQUEST_QUEUE
   102             ClientRequestQueue().RequestOptionalRamL(aMessage);
   128             ClientRequestQueue().RequestOptionalRamL(aMessage);
   103 #else
   129 #else
   104             iRequestFreeRam = aMessage;
   130             iRequestFreeRam = aMessage;
   105             iMinimumMemoryRequested = aMessage.Int1();
   131             iMinimumMemoryRequested = aMessage.Int1();
   106             Monitor().FreeOptionalRamL(aMessage.Int0(), aMessage.Int2());
   132             Monitor().FreeOptionalRamL(aMessage.Int0(), aMessage.Int2(), IsDataPaged(aMessage));
   107 #endif            
   133 #endif            
   108             break;
   134             break;
   109             
   135             
   110         case EOomMonitorSetPriorityBusy:
   136         case EOomMonitorSetPriorityBusy:
   111             Monitor().SetPriorityBusy(aMessage.Int0());
   137             Monitor().SetPriorityBusy(aMessage.Int0());