|
1 /* |
|
2 * Copyright (c) 2006-2010 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 #include "oompluginwaiter.h" |
|
20 #include "oomrunplugin.h" |
|
21 #include "OomTraces.h" |
|
22 #include "oomconstants.hrh" |
|
23 |
|
24 COomPluginWaiter* COomPluginWaiter::NewL(TInt aMillisecondsToWait, COomRunPlugin& aCallbackClass) |
|
25 { |
|
26 FUNC_LOG; |
|
27 |
|
28 COomPluginWaiter* self = new (ELeave) COomPluginWaiter(aMillisecondsToWait, aCallbackClass); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 COomPluginWaiter::COomPluginWaiter(TInt aMillisecondsToWait, COomRunPlugin& aCallbackClass) : CTimer(EPriorityStandard), iMillisecondsToWait(aMillisecondsToWait), iCallbackClass(aCallbackClass) |
|
36 { |
|
37 FUNC_LOG; |
|
38 |
|
39 CActiveScheduler::Add(this); |
|
40 } |
|
41 |
|
42 // Start the timer, it will call the plugin back when it expires |
|
43 void COomPluginWaiter::Start() |
|
44 { |
|
45 FUNC_LOG; |
|
46 |
|
47 HighRes(iMillisecondsToWait * KMicrosecondsInMillisecond); |
|
48 } |
|
49 |
|
50 void COomPluginWaiter::RunL() |
|
51 { |
|
52 FUNC_LOG; |
|
53 |
|
54 iCallbackClass.WaitCompleted(); |
|
55 } |