|
1 // Copyright (c) 2007-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 #ifndef __WSMEMMGR_H__ |
|
17 #define __WSMEMMGR_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 class CWsMemoryManager: public CBase, private RAllocator |
|
22 { |
|
23 public: |
|
24 static CWsMemoryManager * NewLC(); |
|
25 ~CWsMemoryManager(); |
|
26 |
|
27 void EnableReserve(); |
|
28 void DisableReserve(); |
|
29 |
|
30 public: |
|
31 static CWsMemoryManager * Static(); |
|
32 TInt Count() const; |
|
33 |
|
34 private: |
|
35 CWsMemoryManager(); |
|
36 void ConstructL(); |
|
37 // implementing RAllocator |
|
38 TAny* Alloc(TInt aSize); |
|
39 void Free(TAny* aPtr); |
|
40 TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode); |
|
41 TInt AllocLen(const TAny* aCell) const; |
|
42 TInt Compress(); |
|
43 void Reset(); |
|
44 TInt AllocSize(TInt& aTotalAllocSize) const; |
|
45 TInt Available(TInt& aBiggestBlock) const; |
|
46 TInt DebugFunction(TInt aFunc, TAny* a1, TAny* a2); |
|
47 |
|
48 |
|
49 private: |
|
50 static CWsMemoryManager * iStatic; |
|
51 |
|
52 private: |
|
53 RAllocator* iImpl; |
|
54 TBool iReleasing; |
|
55 TBool iReserveEnabled; |
|
56 TInt iReserveSize; |
|
57 TAny* iReserve; |
|
58 }; |
|
59 |
|
60 #endif //__WSMEMMGR_H__ |
|
61 |