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". |
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 if(err == KErrNone) |
|
197 { |
|
198 dataPaged = processName.DefaultDataPaged(); |
|
199 processName.Close(); |
|
200 } |
|
201 clientThread.Close(); |
|
202 } |
|
203 else |
|
204 { |
|
205 OomMonitorPanic(KInvalidClientRequestType); |
|
206 } |
|
207 |
|
208 switch (request->iClientRequestType) |
189 switch (request->iClientRequestType) |
209 { |
190 { |
210 case EClientServerRequestOptionalRam: |
191 case EClientServerRequestOptionalRam: |
211 { |
192 { |
212 TInt pluginId = request->iRequestFreeRamMessage.Int2(); |
193 TInt pluginId = request->iRequestFreeRamMessage.Int2(); |
213 iMonitor.FreeOptionalRamL(request->iBytesRequested, pluginId, dataPaged); |
194 iMonitor.FreeOptionalRamL(request->iBytesRequested, pluginId); |
214 break; |
195 break; |
215 } |
196 } |
216 case EClientServerRequestFreeMemory: |
197 case EClientServerRequestFreeMemory: |
217 iMonitor.RequestFreeMemoryL(request->iBytesRequested, dataPaged); |
198 iMonitor.RequestFreeMemoryL(request->iBytesRequested); |
218 break; |
199 break; |
219 case EPublishAndSubscribe: |
200 case EPublishAndSubscribe: |
220 iMonitor.RequestFreeMemoryPandSL(request->iBytesRequested); |
201 iMonitor.RequestFreeMemoryPandSL(request->iBytesRequested); |
221 break; |
202 break; |
222 default: |
203 default: |
275 { |
256 { |
276 case EClientServerRequestOptionalRam: |
257 case EClientServerRequestOptionalRam: |
277 message = request->iRequestFreeRamMessage; |
258 message = request->iRequestFreeRamMessage; |
278 if (!message.IsNull()) |
259 if (!message.IsNull()) |
279 { |
260 { |
280 TInt memoryAvailable = aBytesFree - iMonitor.GoodRamThreshold(); |
261 TInt memoryAvailable = aBytesFree - iMonitor.GoodThreshold(); |
281 TInt minimumNeeded = message.Int1(); |
262 TInt minimumNeeded = message.Int1(); |
282 if (memoryAvailable >= minimumNeeded) |
263 if (memoryAvailable >= minimumNeeded) |
283 { |
264 { |
284 message.Complete(memoryAvailable); |
265 message.Complete(memoryAvailable); |
285 } |
266 } |