uiacceltk/hitchcock/goommonitor/inc/goomactionref.h
changeset 64 9f8c0686fb49
equal deleted inserted replaced
-1:000000000000 64:9f8c0686fb49
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Classes for executing Graphics OOM actions (e.g. closing applications and running plugins).
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GOOMACTIONREF_H_
       
    20 #define GOOMACTIONREF_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "goomactionconfig.h"
       
    24 
       
    25 class CGOomRunPlugin;
       
    26 class CGOomAction;
       
    27 
       
    28 /**
       
    29  *  Encapsulates a reference to an action. 
       
    30  *  
       
    31  *  Objects of this T-class are instantiated at memory freeing time in preference to the  
       
    32  *  CGOomAction derived objects, so that we do not instantiate anything on the heap at a time
       
    33  *  when the device is, by-definition, low on memory.
       
    34  *
       
    35  *  @lib oommonitor.lib
       
    36  *  @since S60 v5.0
       
    37  */
       
    38 class TActionRef
       
    39     {
       
    40 public:
       
    41     
       
    42     enum TActionType
       
    43         {
       
    44         EAppPlugin,
       
    45         ESystemPlugin,
       
    46         EAppClose
       
    47         };
       
    48 
       
    49     //constructor for Plugin actions
       
    50     TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, CGOomRunPlugin& aRunPlugin, TUint aWgIndexOfTargetApp);
       
    51 
       
    52     //constructor for AppClose actions
       
    53     TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex, TInt aCloseTimeout = 0, TInt aWaitAfterClose = 0);
       
    54     
       
    55     TActionType Type() const;
       
    56     TUint Priority() const;
       
    57     void SetPriority(TUint);
       
    58     TGOomSyncMode SyncMode() const;
       
    59     TInt RamEstimate() const;
       
    60     TInt WgId() const;
       
    61     TInt WgIndex() const;
       
    62     CGOomRunPlugin& RunPlugin();
       
    63     TInt CloseTimeout() const;
       
    64     TInt WaitAfterClose() const;
       
    65     TBool IsRunning();
       
    66 
       
    67 private: //data
       
    68     
       
    69     TActionType iType;
       
    70     TUint iPriority;
       
    71     TGOomSyncMode iSyncMode; //needed as we don't have reference to the config 
       
    72     TInt iRamEstimate; //needed as we don't have reference to the config 
       
    73     TInt iWgId; //For AppClose
       
    74     TInt iWgIndex;
       
    75     CGOomRunPlugin* iRunPlugin; //For Plugins. Not owned
       
    76     TInt iCloseTimeout; //For AppClose
       
    77     TInt iWaitAfterClose; //For AppClose
       
    78 public:
       
    79     CGOomAction* iAppPlugin; // because of stupid desing, not owned
       
    80     };
       
    81 
       
    82 #endif /*GOOMACTIONREF_H_*/