sysresmonitoring/oommonitor/inc/oomoutofmemorywatcher.h
branchRCL_3
changeset 1 0fdb7f6b0309
child 18 0818dd463d41
equal deleted inserted replaced
0:2e3d3ce01487 1:0fdb7f6b0309
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Main classes for Out of Memory Monitor.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OOMOUTOFMEMORYWATCHER_H
       
    20 #define OOMOUTOFMEMORYWATCHER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CMemoryMonitor;
       
    25 
       
    26 /**
       
    27  *  This class is an active object which monitors a kernel change notifer for changes in the 
       
    28  *  low and good memory thresholds. 
       
    29  *  
       
    30  *  @lib oommonitor.lib
       
    31  *  @since S60 v5.0
       
    32  */
       
    33 NONSHARABLE_CLASS(COutOfMemoryWatcher) : public CActive
       
    34     {
       
    35 public:
       
    36     static COutOfMemoryWatcher* NewL(CMemoryMonitor& aLafShutdown, TInt aLowThreshold, TInt aGoodThreshold);
       
    37     ~COutOfMemoryWatcher();
       
    38     void Start();
       
    39     
       
    40     /**
       
    41      * Set the Low and Good thresholds that we are listening for.
       
    42      * These values can change from the global default values when certain applications are in the foreground.
       
    43      * @param aLowThreshold If Ram Level drops below the low threshold Oom Monitor actions are started.
       
    44      * @param aGoodThreshold When memory returns above the Good threshold then Oom Monitor stops freeing memory.
       
    45      */
       
    46     void UpdateThresholds(TInt aLowThreshold, TInt aGoodThreshold);
       
    47 private:
       
    48     COutOfMemoryWatcher(CMemoryMonitor& aLafShutdown);
       
    49     void ConstructL(TInt aLowThreshold, TInt aGoodThreshold);
       
    50 private: // from CActive
       
    51     void DoCancel();
       
    52     void RunL();
       
    53 private: // data
       
    54     RChangeNotifier iChangeNotifier;
       
    55     CMemoryMonitor& iLafShutdown;
       
    56     };
       
    57 
       
    58 #endif /*OOMOUTOFMEMORYWATCHER_H*/