|
1 /* |
|
2 * Copyright (c) 2006 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: Classes for executing OOM actions (e.g. closing applications and running plugins). |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef OOMRUNPLUGIN_H_ |
|
20 #define OOMRUNPLUGIN_H_ |
|
21 |
|
22 #include "oomaction.h" |
|
23 |
|
24 class COomRunPlugin; |
|
25 class COomRunPluginConfig; |
|
26 class MOomActionObserver; |
|
27 class COomPluginWaiter; |
|
28 class COomMonitorPlugin; |
|
29 class COomMonitorPluginV2; |
|
30 class COomActionConfig; |
|
31 |
|
32 /* |
|
33 * The OOM action of running an OOM plug-in to free up memory. |
|
34 * |
|
35 * @lib oommonitor.lib |
|
36 * @since S60 v5.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS(COomRunPlugin) : public COomAction |
|
39 { |
|
40 public: |
|
41 static COomRunPlugin* NewL(TUint aPluginId, COomRunPluginConfig& aConfig, MOomActionObserver& aStateChangeObserver, COomMonitorPlugin& aPlugin, COomMonitorPluginV2* aV2Plugin = NULL); |
|
42 |
|
43 ~COomRunPlugin(); |
|
44 |
|
45 // Run the OOM plugin in order to free memory |
|
46 // Call the COomAction::MemoryFreed when it is done |
|
47 virtual void FreeMemory(TInt aBytesRequested); |
|
48 |
|
49 // Call the memory good function on the plugin but... |
|
50 // only if there is an outstanding FreeMemory request |
|
51 void MemoryGood(); |
|
52 |
|
53 inline TBool IsRunning(); |
|
54 |
|
55 // To be called by the COomPluginWaiter |
|
56 inline void WaitCompleted(); |
|
57 |
|
58 protected: |
|
59 |
|
60 void ConstructL(COomRunPluginConfig& aPluginConfig); |
|
61 |
|
62 inline COomActionConfig& GetConfig(); |
|
63 |
|
64 private: |
|
65 |
|
66 COomRunPlugin(TUint aPluginId, COomRunPluginConfig& aConfig, MOomActionObserver& aStateChangeObserver, COomMonitorPlugin& aPlugin, COomMonitorPluginV2* aV2Plugin); |
|
67 |
|
68 TUint iPluginId; |
|
69 |
|
70 COomMonitorPlugin& iPlugin; |
|
71 |
|
72 COomRunPluginConfig& iConfig; |
|
73 |
|
74 COomPluginWaiter* iPluginWaiter; |
|
75 |
|
76 // Note that this shouldn't be deleted |
|
77 // If it is pointing to a V2 plugin then it is a cast to the same instance as iPlugin |
|
78 COomMonitorPluginV2* iV2Plugin; |
|
79 |
|
80 TBool iFreeMemoryCalled; // True if FreeMemory has been called since the last call to MemoryGood |
|
81 }; |
|
82 |
|
83 #include "oomrunplugin.inl" |
|
84 |
|
85 #endif /*OOMRUNPLUGIN_H_*/ |