0
|
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 |
|
|
17 |
#ifndef __MMFCONTROLLERHEAP_H__
|
|
18 |
#define __MMFCONTROLLERHEAP_H__
|
|
19 |
|
|
20 |
#include <e32base.h>
|
|
21 |
|
|
22 |
/*
|
|
23 |
To prevent an MMF client with multiple controllers running out of chunks, all
|
|
24 |
controllers for the same client are made to use the same heap.
|
|
25 |
|
|
26 |
This class controls that shared heap.
|
|
27 |
|
|
28 |
The iRefCount tracks the number of controllers using the heap.
|
|
29 |
|
|
30 |
When the client requests a pointer to the heap - RegisterHeap() - it is
|
|
31 |
assumed that a controller will be created using it, so the refcount
|
|
32 |
is automatically incremented. When the controller terminates, the client
|
|
33 |
unregisters - ReleaseHeap() - and the ref count is decreased.
|
|
34 |
When the refcount is zero (no controller threads left) the client deletes
|
|
35 |
this class.
|
|
36 |
*/
|
|
37 |
|
|
38 |
const TInt KMMFControllerSharedHeapMaxSize = 0x1000000;//16MB
|
|
39 |
|
|
40 |
NONSHARABLE_CLASS(CMMFControllerHeap) : public CBase
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
static CMMFControllerHeap* NewL();
|
|
44 |
~CMMFControllerHeap();
|
|
45 |
|
|
46 |
RHeap* RegisterHeap();
|
|
47 |
TInt ReleaseHeap();
|
|
48 |
private:
|
|
49 |
void ConstructL();
|
|
50 |
private:
|
|
51 |
RHeap* iHeap;
|
|
52 |
TInt iRefCount;
|
|
53 |
};
|
|
54 |
|
|
55 |
#endif
|