|
1 // Copyright (c) 2007-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 #ifndef __FIREANDFORGET_H__ |
|
17 #define __FIREANDFORGET_H__ |
|
18 |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <e32cmn.h> |
|
22 #include <apastarter.h> |
|
23 #include <e32debug.h> |
|
24 |
|
25 #include "ssmloadsysmon.h" |
|
26 #include "timeoutwaiternotification.h" |
|
27 #include <ssm/ssmstartupproperties.h> |
|
28 #include "ssconst.h" |
|
29 |
|
30 /** |
|
31 @internalTechnology |
|
32 @released |
|
33 */ |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 class CApaStarter; |
|
39 class CTimeoutWaiter; |
|
40 |
|
41 /** |
|
42 An active object that can be used to start the process or application with Fire and Forget |
|
43 execution behaviour. This object deletes itself once the process has Rendezvous'd successfully, or |
|
44 when process's Rendezvous has not succeeded and retries(if any), have been exhausted. |
|
45 */ |
|
46 NONSHARABLE_CLASS( CFireAndForget ): public CActive, public MTimeoutWaiterNotification |
|
47 { |
|
48 public: |
|
49 static CFireAndForget* NewL( const CSsmStartupProperties& aStartupProperties ); |
|
50 static CFireAndForget* NewLC( const CSsmStartupProperties& aStartupProperties ); |
|
51 ~CFireAndForget(); |
|
52 void FireD(); |
|
53 |
|
54 // From MTimeoutWaiterNotification |
|
55 void NotifyTimeout(); |
|
56 |
|
57 protected: |
|
58 void RunL(); |
|
59 void DoCancel(); |
|
60 TInt RunError( TInt aError ); |
|
61 |
|
62 private: |
|
63 CFireAndForget(); |
|
64 void ConstructL( const CSsmStartupProperties& aStartupProperties ); |
|
65 void CleanupOrRetryL(); |
|
66 void InvokeL(); |
|
67 TBool GoodStart(); |
|
68 TInt GetProcessHandle( RProcess& aProcess, const TThreadId& aThreadId ); |
|
69 void LoadApStartLibL(); |
|
70 void StartMonitorIfRequiredL(); |
|
71 |
|
72 enum TFireAndForgetState |
|
73 { |
|
74 EFAndFIdle = 0, |
|
75 EFAndFStateRetrying |
|
76 }; |
|
77 |
|
78 private: |
|
79 CApaStarter* iApaStarter; |
|
80 CSsmStartupProperties* iStartupProperties; |
|
81 TInt iRetries; |
|
82 CTimeoutWaiter* iTimeoutWaiter; |
|
83 TFireAndForgetState iState; |
|
84 TThreadId iThreadId; |
|
85 RProcess iProcess; |
|
86 RLibrary iApStartLib; |
|
87 RLibrary iSysMonProxyLib; |
|
88 }; |
|
89 |
|
90 |
|
91 #endif // __FIREANDFORGET_H__ |