|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <push/pluginkiller.h> |
|
17 #include <push/cpushhandlerbase.h> |
|
18 |
|
19 |
|
20 /** |
|
21 Constructor. |
|
22 |
|
23 @param aPushPlugin The plugin owner to be deleted |
|
24 |
|
25 @internalComponent |
|
26 */ |
|
27 CPluginKiller::CPluginKiller(CPushHandlerBase* aPushPlugin) |
|
28 : CActive(EPriorityStandard), iPushPlugin(aPushPlugin), iDeletePushPlugin(EFalse) |
|
29 { |
|
30 CActiveScheduler::Add(this); |
|
31 } |
|
32 |
|
33 |
|
34 /** |
|
35 Destructor. |
|
36 */ |
|
37 CPluginKiller::~CPluginKiller() |
|
38 { |
|
39 // Responsible for Deleting Plugin Owners. |
|
40 Cancel(); |
|
41 __ASSERT_DEBUG(iDeletePushPlugin, User::Invariant()); |
|
42 delete iPushPlugin; |
|
43 } |
|
44 |
|
45 |
|
46 /** |
|
47 Deletes the plug-in. |
|
48 */ |
|
49 EXPORT_C void CPluginKiller::KillPushPlugin() |
|
50 { |
|
51 //Starts a completed asynchronous request to delete the plug-in. |
|
52 //When RunL() runs, it deletes the plug-in and the plug-in killer object itself. |
|
53 |
|
54 TRequestStatus* pS=&iStatus; |
|
55 User::RequestComplete(pS,KErrNone); |
|
56 SetActive(); |
|
57 } |
|
58 |
|
59 /** |
|
60 Cancel the request |
|
61 */ |
|
62 void CPluginKiller::DoCancel() |
|
63 { |
|
64 } |
|
65 |
|
66 |
|
67 /** |
|
68 Handles the completion of an asynchronous request. RunL() will only be called by the plug-in |
|
69 killer completing its own request in KillPushPlugin(). This method sets a flag to indicate |
|
70 that it is safe to delete the plugin owner in the destructor. This ensures that the plug-in |
|
71 killer object is only deleted if the push plugin is deleted. |
|
72 */ |
|
73 void CPluginKiller::RunL() |
|
74 { |
|
75 iDeletePushPlugin = ETrue; |
|
76 delete this; |
|
77 } |