|
1 /* |
|
2 * Copyright (c) 2009 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: carunningapphandler.cpp |
|
15 * |
|
16 */ |
|
17 #include "carunningapphandler.h" |
|
18 |
|
19 #include "cadef.h" |
|
20 #include "carunningappmonitor.h" |
|
21 |
|
22 // ----------------------------------------------------------------------------- |
|
23 // CCaRunningAppHandler |
|
24 // ----------------------------------------------------------------------------- |
|
25 // |
|
26 CCaRunningAppHandler* CCaRunningAppHandler::NewL( TPluginParams* aParams ) |
|
27 { |
|
28 if( aParams == 0 || aParams->storageProxy == 0 ) |
|
29 { |
|
30 User::Leave(KErrCorrupt); |
|
31 } |
|
32 CCaRunningAppHandler* self = new (ELeave)CCaRunningAppHandler(); |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL( *aParams->storageProxy ); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CCaRunningAppHandler |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CCaRunningAppHandler::~CCaRunningAppHandler() |
|
44 { |
|
45 iRunningTasks.ResetAndDestroy(); |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CCaRunningAppHandler |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CCaRunningAppHandler::CCaRunningAppHandler() |
|
53 : |
|
54 iRunningTasks( KDefaultGranularity ) |
|
55 { |
|
56 //no implementation required |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // ConstructL |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CCaRunningAppHandler::ConstructL( CCaStorageProxy& aStorage ) |
|
64 { |
|
65 CCaRunningAppMonitor::ExecuteL( *this, aStorage ); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // RegisterTaskL |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CCaRunningAppHandler::RegisterTaskL( CBase* aTask ) |
|
73 { |
|
74 iRunningTasks.AppendL( aTask ); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // UnregisterTask |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CCaRunningAppHandler::UnregisterTask( CBase* aTask ) |
|
82 { |
|
83 const TInt index( iRunningTasks.FindReverse( aTask ) ); |
|
84 if( index != KErrNotFound ) |
|
85 { |
|
86 iRunningTasks.Remove( index ); |
|
87 } |
|
88 } |