|
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: Classes for executing GOOM actions (e.g. closing applications and running plugins). |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GOOMACTION_H_ |
|
20 #define GOOMACTION_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class MGOomActionObserver; |
|
25 |
|
26 /* |
|
27 * The base class for all GOOM actions (i.e. close application or run GOOM plug-in). |
|
28 * |
|
29 * A base class is used because both types of action have common aspects, specifically: |
|
30 * - They are prioritised according to application idle time |
|
31 * - They need to be prioritised against each other |
|
32 * - For each action it is possible to either continue immediately or to wait for completion |
|
33 * |
|
34 * @lib goommonitor.lib |
|
35 * @since S60 v5.0 |
|
36 */ |
|
37 NONSHARABLE_CLASS(CGOomAction) : public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 virtual ~CGOomAction(); |
|
42 |
|
43 /** |
|
44 * Activate the OOM action |
|
45 * |
|
46 * @since S60 5.0 |
|
47 * @param aBytesRequested ?description |
|
48 */ |
|
49 virtual void FreeMemory(TInt aBytesRequested) = 0; |
|
50 |
|
51 /** |
|
52 * @since S60 5.0 |
|
53 * @return ETrue if the action is currently freeing memory, else EFalse |
|
54 */ |
|
55 virtual TBool IsRunning() = 0; |
|
56 |
|
57 protected: |
|
58 // |
|
59 /** |
|
60 * To be called by the derived class after the memory has been freed (or if it fails) |
|
61 * |
|
62 * @since S60 5.0 |
|
63 * @param aError KErrNone if memory has successfully been freed, otherwise any system wide error code |
|
64 */ |
|
65 void MemoryFreed(TInt aError); |
|
66 |
|
67 CGOomAction(MGOomActionObserver& aStateChangeObserver); |
|
68 |
|
69 private: //data |
|
70 |
|
71 enum TGOomActionState |
|
72 { |
|
73 EGOomIdle, |
|
74 EGOomFreeingMemory |
|
75 }; |
|
76 TGOomActionState iState; |
|
77 |
|
78 protected: |
|
79 MGOomActionObserver& iStateChangeObserver; |
|
80 }; |
|
81 |
|
82 #endif /*GOOMACTION_H_*/ |