|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Main classes for Graphics Out of Memory Monitor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "goommemorymonitorserver.h" |
|
20 #include "goommonitorclientserver.h" |
|
21 #include "goommemorymonitorsession.h" |
|
22 #include "goommemorymonitor.h" |
|
23 #include "goomtraces.h" |
|
24 |
|
25 CMemoryMonitorServer* CMemoryMonitorServer::NewL(CMemoryMonitor& aMonitor) |
|
26 { |
|
27 FUNC_LOG; |
|
28 RDebug::Print(_L("GOOM: CMemoryMonitorServer::NewL")); |
|
29 CMemoryMonitorServer* self=new(ELeave) CMemoryMonitorServer(aMonitor); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 RDebug::Print(_L("GOOM: CMemoryMonitorServer::NewL EXIT")); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CMemoryMonitorServer::~CMemoryMonitorServer() |
|
38 { |
|
39 FUNC_LOG; |
|
40 } |
|
41 |
|
42 CMemoryMonitorServer::CMemoryMonitorServer(CMemoryMonitor& aMonitor) |
|
43 :CServer2(CActive::EPriorityStandard), iMonitor(aMonitor) |
|
44 { |
|
45 FUNC_LOG; |
|
46 } |
|
47 |
|
48 void CMemoryMonitorServer::ConstructL() |
|
49 { |
|
50 FUNC_LOG; |
|
51 RDebug::Print(_L("GOOM: CMemoryMonitorServer::ConstructL start server")); |
|
52 |
|
53 StartL(KGraphicsMemoryMonitorServerName); |
|
54 RDebug::Print(_L("GOOM: CMemoryMonitorServer::ConstructL EXIT")); |
|
55 } |
|
56 |
|
57 CSession2* CMemoryMonitorServer::NewSessionL(const TVersion& /*aVersion*/, const RMessage2& /*aMessage*/) const |
|
58 { |
|
59 FUNC_LOG; |
|
60 |
|
61 return new(ELeave) CMemoryMonitorSession(); |
|
62 } |
|
63 |
|
64 TInt CMemoryMonitorServer::RunError(TInt aError) |
|
65 { |
|
66 FUNC_LOG; |
|
67 |
|
68 Message().Complete(aError); |
|
69 // |
|
70 // The leave will result in an early return from CServer::RunL(), skipping |
|
71 // the call to request another message. So do that now in order to keep the |
|
72 // server running. |
|
73 ReStart(); |
|
74 return KErrNone; // handled the error fully |
|
75 } |
|
76 |
|
77 CMemoryMonitor& CMemoryMonitorServer::Monitor() |
|
78 { |
|
79 FUNC_LOG; |
|
80 |
|
81 return iMonitor; |
|
82 } |
|
83 |
|
84 void CMemoryMonitorServer::CloseAppsFinished(TInt aBytesFree, TBool aMemoryGood) |
|
85 { |
|
86 FUNC_LOG; |
|
87 |
|
88 iSessionIter.SetToFirst(); |
|
89 CSession2* s; |
|
90 while ((s = iSessionIter++) != 0) |
|
91 static_cast<CMemoryMonitorSession*>(s)->CloseAppsFinished(aBytesFree, aMemoryGood); |
|
92 } |