equal
deleted
inserted
replaced
|
1 // Copyright (c) 2005-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 #include "mmfcontrollerheap.h" |
|
17 |
|
18 |
|
19 CMMFControllerHeap* CMMFControllerHeap::NewL() |
|
20 { |
|
21 CMMFControllerHeap* self = new(ELeave) CMMFControllerHeap; |
|
22 CleanupStack::PushL(self); |
|
23 self->ConstructL(); |
|
24 CleanupStack::Pop(); |
|
25 return self; |
|
26 } |
|
27 |
|
28 void CMMFControllerHeap::ConstructL() |
|
29 { |
|
30 TChunkHeapCreateInfo chunkSettings (KMinHeapSize, KMMFControllerSharedHeapMaxSize); |
|
31 chunkSettings.SetPaging(TChunkHeapCreateInfo::EUnpaged); |
|
32 iHeap = User::ChunkHeap(chunkSettings); |
|
33 if (iHeap == NULL) |
|
34 { |
|
35 User::Leave(KErrNoMemory); |
|
36 } |
|
37 |
|
38 iRefCount = 0; |
|
39 } |
|
40 |
|
41 RHeap* CMMFControllerHeap::RegisterHeap() |
|
42 { |
|
43 iRefCount++; |
|
44 return iHeap; |
|
45 } |
|
46 |
|
47 TInt CMMFControllerHeap::ReleaseHeap() |
|
48 { |
|
49 return --iRefCount; |
|
50 } |
|
51 |
|
52 CMMFControllerHeap::~CMMFControllerHeap() |
|
53 { |
|
54 if( iHeap ) |
|
55 { |
|
56 iHeap->Close(); |
|
57 } |
|
58 } |
|
59 |
|
60 |