1 /* |
1 /* |
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 * @since S60 v5.0 |
31 * @since S60 v5.0 |
32 */ |
32 */ |
33 NONSHARABLE_CLASS(COutOfMemoryWatcher) : public CActive |
33 NONSHARABLE_CLASS(COutOfMemoryWatcher) : public CActive |
34 { |
34 { |
35 public: |
35 public: |
36 static COutOfMemoryWatcher* NewL(CMemoryMonitor& aLafShutdown, TInt aLowThreshold, TInt aGoodThreshold); |
36 static COutOfMemoryWatcher* NewL(CMemoryMonitor& aMonitor, TInt aLowRamThreshold, TInt aGoodRamThreshold, |
|
37 TBool aSwapUsageMonitored, TInt aLowSwapThreshold, TInt aGoodSwapThreshold); |
37 ~COutOfMemoryWatcher(); |
38 ~COutOfMemoryWatcher(); |
38 void Start(); |
39 void Start(); |
39 |
40 |
40 /** |
41 /** |
41 * Set the Low and Good thresholds that we are listening for. |
42 * 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 * 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 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 * @param aGoodThreshold When memory returns above the Good threshold then Oom Monitor stops freeing memory. |
45 */ |
46 */ |
46 void UpdateThresholds(TInt aLowThreshold, TInt aGoodThreshold); |
47 void UpdateThresholds(TInt aLowRamThreshold, TInt aGoodRamThreshold, TInt aLowSwapThreshold, TInt aGoodSwapThreshold); |
47 private: |
48 private: |
48 COutOfMemoryWatcher(CMemoryMonitor& aLafShutdown); |
49 COutOfMemoryWatcher(CMemoryMonitor& aMonitor, TBool aSwapUsageMonitored); |
49 void ConstructL(TInt aLowThreshold, TInt aGoodThreshold); |
50 void ConstructL(TInt aLowRamThreshold, TInt aGoodRamThreshold, TInt aLowSwapThreshold, TInt aGoodSwapThreshold); |
50 private: // from CActive |
51 private: // from CActive |
51 void DoCancel(); |
52 void DoCancel(); |
52 void RunL(); |
53 void RunL(); |
53 private: // data |
54 private: // data |
54 RChangeNotifier iChangeNotifier; |
55 RChangeNotifier iChangeNotifier; |
55 CMemoryMonitor& iLafShutdown; |
56 CMemoryMonitor& iMemoryMonitor; |
|
57 TBool iSwapUsageMonitored; |
56 }; |
58 }; |
57 |
59 |
58 #endif /*OOMOUTOFMEMORYWATCHER_H*/ |
60 #endif /*OOMOUTOFMEMORYWATCHER_H*/ |