sysresmonitoring/oommonitor/src/oomclientrequestqueue.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".
   183     FUNC_LOG;
   183     FUNC_LOG;
   184     
   184     
   185     iClientRequestActive = ETrue;
   185     iClientRequestActive = ETrue;
   186 
   186 
   187     TClientRequest* request = iQueue.First();
   187     TClientRequest* request = iQueue.First();
   188 
   188     
       
   189     RThread clientThread;
       
   190     TInt err =  (request->iRequestFreeRamMessage).Client(clientThread);
       
   191     TBool dataPaged = EFalse;
       
   192     if(err == KErrNone)
       
   193         {
       
   194         RProcess processName;
       
   195         err = clientThread.Process(processName);
       
   196         dataPaged = processName.DefaultDataPaged();
       
   197         }
       
   198     else
       
   199         {
       
   200         OomMonitorPanic(KInvalidClientRequestType);
       
   201         }
       
   202     
       
   203     
   189     switch (request->iClientRequestType)
   204     switch (request->iClientRequestType)
   190         {
   205         {
   191         case EClientServerRequestOptionalRam:
   206         case EClientServerRequestOptionalRam:
   192             {
   207             {
   193             TInt pluginId = request->iRequestFreeRamMessage.Int2();
   208             TInt pluginId = request->iRequestFreeRamMessage.Int2();
   194             iMonitor.FreeOptionalRamL(request->iBytesRequested, pluginId);
   209             iMonitor.FreeOptionalRamL(request->iBytesRequested, pluginId, dataPaged);
   195             break;
   210             break;
   196             }
   211             }
   197         case EClientServerRequestFreeMemory:
   212         case EClientServerRequestFreeMemory:
   198             iMonitor.RequestFreeMemoryL(request->iBytesRequested);
   213             iMonitor.RequestFreeMemoryL(request->iBytesRequested, dataPaged);
   199             break;
   214             break;
   200         case EPublishAndSubscribe:
   215         case EPublishAndSubscribe:
   201             iMonitor.RequestFreeMemoryPandSL(request->iBytesRequested);
   216             iMonitor.RequestFreeMemoryPandSL(request->iBytesRequested);
   202             break;
   217             break;
   203         default:
   218         default:
   256             {
   271             {
   257             case EClientServerRequestOptionalRam:
   272             case EClientServerRequestOptionalRam:
   258                 message = request->iRequestFreeRamMessage;
   273                 message = request->iRequestFreeRamMessage;
   259                 if (!message.IsNull())
   274                 if (!message.IsNull())
   260                     {
   275                     {
   261                     TInt memoryAvailable = aBytesFree - iMonitor.GoodThreshold();
   276                     TInt memoryAvailable = aBytesFree - iMonitor.GoodRamThreshold();
   262                     TInt minimumNeeded = message.Int1();
   277                     TInt minimumNeeded = message.Int1();
   263                     if (memoryAvailable >= minimumNeeded)
   278                     if (memoryAvailable >= minimumNeeded)
   264                         {
   279                         {
   265                         message.Complete(memoryAvailable);
   280                         message.Complete(memoryAvailable);
   266                         }
   281                         }