sysstatemgmt/systemstarter/startsafesrc/startsafe.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2006-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 
       
    17 #ifndef __STARTSAFE_H__
       
    18 #define __STARTSAFE_H__
       
    19 
       
    20 #include <e32def.h>
       
    21 #include <f32file.h>
       
    22 #include <sysmonclisess.h>
       
    23 #include <startup.hrh>
       
    24 
       
    25 
       
    26 /**
       
    27 @internalTechnology
       
    28 @released
       
    29 */
       
    30 const TInt KStartSafeNoTimeout = 0;
       
    31 
       
    32 
       
    33 class CApaStarter;
       
    34 class CStartupProperties;
       
    35 
       
    36 /**
       
    37 Used to start a process or application reliably. 
       
    38 Which means, if the starting fails after designated number of attempts then system restarts or an error is returned.
       
    39 @internalTechnology
       
    40 @deprecated Instead of this use CSsmStartSafe
       
    41 */
       
    42 NONSHARABLE_CLASS( CStartSafe ) : public CBase
       
    43 	{
       
    44 public:
       
    45 	IMPORT_C static CStartSafe* NewL();
       
    46 	virtual ~CStartSafe();		
       
    47 	
       
    48 	IMPORT_C void StartL( const CStartupProperties &aStartupProperties, RProcess& aProcess, TInt& aNumRetried ); 	
       
    49 	IMPORT_C void StartL( const CStartupProperties &aStartupProperties, RProcess& aProcess, TRequestStatus& aCommandTrs );
       
    50 	IMPORT_C void StartAndMonitorL( const CStartupProperties &aStartupProperties, RProcess& aProcess, TInt& aNumRetried );
       
    51 	IMPORT_C void InitAppArcServer( TRequestStatus& aStatus );
       
    52 	
       
    53 private:	
       
    54 	CStartSafe();
       
    55 	void ConstructL();
       
    56 	
       
    57 	void InstituteRestartL( const CStartupProperties& aStartupProperties );
       
    58 	TInt AwaitRendezvous( RProcess& aProcess, TInt aTimeout );
       
    59 	TInt AwaitProcessStartup( RProcess& aProcess, TInt aTimeout, TRequestStatus& aCommandTrs );
       
    60 	void DoFireAndForgetL( const CStartupProperties& aStartupProperties, RProcess& aProcess );
       
    61 	void DoWaitForStartL( const CStartupProperties& aStartupProperties, RProcess& aProcess, TInt& aNumRetried );				
       
    62 	TInt DoStartAppWithRetries( const CStartupProperties& aStartupProperties, RProcess& aProcess, TInt& aNumRetried );
       
    63 	void GetProcessHandleL( RProcess& aProcess, const TThreadId& aThreadId );
       
    64 	void GetHandleAndWaitForProcessL( const CStartupProperties& aStartupProperties, RProcess& aProcess, TThreadId& aThreadId, TRequestStatus& aCommandTrs );
       
    65 	TInt DoStartProcessWithRetries( const CStartupProperties& aStartupProperties, RProcess& aProcess, TInt& aNumRetried );
       
    66 	void DoStartAppL( const CStartupProperties& aStartupProperties, RProcess& aProcess );
       
    67 	void DoStartProcessL( const CStartupProperties& aStartupProperties, RProcess& aProcess );
       
    68 	void LoadApStartLibL();
       
    69 	void ShootBadProcess( RProcess& aProcess, const TRequestStatus& aStatus );
       
    70 
       
    71 private:	
       
    72 	CApaStarter* iApaStarter;
       
    73 	RLibrary iApStartLib;
       
    74 	};
       
    75 
       
    76 
       
    77 #endif