--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Mon Jun 21 16:41:52 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Thu Jul 15 19:40:07 2010 +0300
@@ -35,7 +35,7 @@
CMemoryMonitorSession::~CMemoryMonitorSession()
{
FUNC_LOG;
- Server().Monitor().SessionInCriticalAllocation(0,iClientId);
+ Server().Monitor().SessionInCriticalAllocation(0,0);
CloseAppsFinished(0, EFalse);
}
@@ -61,32 +61,37 @@
RThread t;
aMessage.Client(t);
- iClientId = t.SecureId();
+ TUint clientId = t.SecureId();
t.Close();
- TRACES1("NEW REQUEST from client %x", iClientId);
+ TRACES1("NEW REQUEST from client %x", clientId);
switch (aMessage.Function())
{
case EGOomMonitorRequestFreeMemory:
//Do not take any more requests from the same client if previous request being served
- if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(iClientId))
+ if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId))
{
- TRACES1("CANNOT PROCESS NEW REQUEST from %x", iClientId);
+ TRACES1("CANNOT PROCESS NEW REQUEST from %x", clientId);
aMessage.Complete(KErrInUse);
return;
}
- Server().Monitor().SetActiveClient(iClientId);
+ Server().Monitor().SetActiveClient(clientId);
// message will be completed when CloseAppsFinished() is called.
if (aMessage.Int1() == 0)
{
iRequestFreeRam = aMessage;
- Server().Monitor().SessionInCriticalAllocation(1, iClientId);
+ Server().Monitor().SessionInCriticalAllocation(1, clientId);
TRAPD(err, Monitor().RequestFreeMemoryL(aMessage.Int0()));
- if (err)
+ if(err == KErrCompletion)
+ {
+ TRACES("There is already enough memory - nothing to do");
+ Server().Monitor().SessionInCriticalAllocation(0, clientId);
+ }
+ else if (err != KErrNone )
{
// completes the message if that was left to pending
TRACES1("Error in RequestFreeMemory %d", err);
@@ -103,8 +108,8 @@
break;
case EGOomMonitorMemoryAllocationsComplete:
- TRACES1("ServiceL : Memory Allocations complete from %x", iClientId);
- Server().Monitor().SessionInCriticalAllocation(0, iClientId);
+ TRACES1("ServiceL : Memory Allocations complete from %x", clientId);
+ Server().Monitor().SessionInCriticalAllocation(0, clientId);
aMessage.Complete(KErrNone);
break;
@@ -113,7 +118,7 @@
{
iRequestFreeRam.Complete(KErrCancel);
}
- Server().Monitor().SessionInCriticalAllocation(0, iClientId);
+ Server().Monitor().SessionInCriticalAllocation(0, clientId);
aMessage.Complete(KErrNone);
break;
@@ -123,11 +128,11 @@
break;
case EGOomMonitorRequestOptionalRam:
- if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(iClientId))
+ if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId))
{
aMessage.Complete(KErrInUse);
}
- Server().Monitor().SetActiveClient(iClientId);
+ Server().Monitor().SetActiveClient(clientId);
// message will be completed when CloseAppsFinished() is called.
iRequestFreeRam = aMessage;
iMinimumMemoryRequested = aMessage.Int1();