contentstorage/casrv/carunningappmonitor/inc/castoragetask.h
changeset 116 305818acdca4
parent 112 dbfb5e38438b
child 119 50e220be30d1
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
     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: castoragetask.h
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CASTORAGETASK_H
       
    19 #define C_CASTORAGETASK_H
       
    20 
       
    21 //includes
       
    22 #include <e32base.h>
       
    23 
       
    24 class CCaStorageProxy;
       
    25 class CCaInnerEntry;
       
    26 class MCaRunningTaskHandler;
       
    27 
       
    28 /**
       
    29  * Class update entry with window group id of running process
       
    30  */
       
    31 NONSHARABLE_CLASS( CCaStorageTask): public CActive
       
    32     {
       
    33 public:
       
    34     /**
       
    35      * Function execute task. Ownership is transfered to task handler.
       
    36      * Task take ownership over window group name.
       
    37      * @param aTaskHandler - running tasks storage
       
    38      * @param aStorage - applications storage
       
    39      * @param aUid - application UID
       
    40      * @param aWgId - application window group id
       
    41      */
       
    42     static void ExecuteL( MCaRunningTaskHandler& aTaskHandler,
       
    43                           CCaStorageProxy& aStorage,
       
    44                           TUid aUid, 
       
    45                           TInt aWgId );
       
    46     
       
    47     /**
       
    48      * Destructor
       
    49      */
       
    50     ~CCaStorageTask();
       
    51 private:
       
    52     /**
       
    53      * First step constructor
       
    54      * @param aTaskHandler - running tasks storage
       
    55      * @param aStorage - applications storage
       
    56      * @param aUid - application UID
       
    57      * @param aWgId - application window group id
       
    58      */
       
    59     CCaStorageTask( MCaRunningTaskHandler& aTaskHandler, 
       
    60                     CCaStorageProxy& aStorage, 
       
    61                     TUid aUid, 
       
    62                     TInt aWgId );
       
    63     
       
    64     /**
       
    65      * Second step constructor
       
    66      */
       
    67     void ConstructL();
       
    68     
       
    69     /**
       
    70      * Function unregister task form task handler and release resources allocated for task
       
    71      */
       
    72     void UnregisterD();
       
    73     
       
    74     /**
       
    75      * Function retrive all entry for application.
       
    76      * @param aArray - destination set of application entry
       
    77      */
       
    78     void GetEntriesL( RPointerArray<CCaInnerEntry>& aArray );
       
    79     
       
    80     /**
       
    81      * Function find and update application entry with window group id. 
       
    82      */
       
    83     TInt UpdateEntryL();
       
    84     
       
    85     /**
       
    86      * Functioin update application entry with window group id.
       
    87      * @param aEntry - application entry
       
    88      */
       
    89     TInt UpdateEntryL( CCaInnerEntry& aEntry );
       
    90 
       
    91 private: //from CActive
       
    92     /**
       
    93      * @see CActive
       
    94      */
       
    95     void RunL();
       
    96     
       
    97     
       
    98     /**
       
    99      * @see CActive
       
   100      */
       
   101     TInt RunError(TInt aError);
       
   102     
       
   103     /**
       
   104      * @see CActive
       
   105      */
       
   106     void DoCancel();
       
   107 
       
   108 private:
       
   109     //members
       
   110     
       
   111     /**
       
   112      * Reference to task handler instance 
       
   113      */
       
   114     MCaRunningTaskHandler& iTaskHandler;
       
   115     
       
   116     /**
       
   117      * Reference to content storage proxy. 
       
   118      */
       
   119     CCaStorageProxy& iStorage;
       
   120     
       
   121     /**
       
   122      * Application UID
       
   123      */
       
   124     const TUid iUid;
       
   125     
       
   126     /**
       
   127      * Applicaion window group id
       
   128      */
       
   129     const TInt iWgId;
       
   130     
       
   131     /**
       
   132      * Timer to re-activate task if try fail
       
   133      */
       
   134     RTimer iTimer;
       
   135     
       
   136     /**
       
   137      * Task execution counter 
       
   138      */
       
   139     TInt iCount;
       
   140     };
       
   141 
       
   142 #endif //C_CASTORAGETASK_H
       
   143