os/mm/mmlibs/mmfw/src/ControllerFramework/mmfcontrollerheap.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
sl@0
    17
#ifndef __MMFCONTROLLERHEAP_H__
sl@0
    18
#define __MMFCONTROLLERHEAP_H__
sl@0
    19
sl@0
    20
#include <e32base.h>
sl@0
    21
sl@0
    22
/*
sl@0
    23
To prevent an MMF client with multiple controllers running out of chunks, all
sl@0
    24
controllers for the same client are made to use the same heap.
sl@0
    25
  
sl@0
    26
This class controls that shared heap.
sl@0
    27
  
sl@0
    28
The iRefCount tracks the number of controllers using the heap.
sl@0
    29
  
sl@0
    30
When the client requests a pointer to the heap - RegisterHeap() - it is 
sl@0
    31
assumed that a controller will be created using it, so the refcount
sl@0
    32
is automatically incremented. When the controller terminates, the client 
sl@0
    33
unregisters - ReleaseHeap() - and the ref count is decreased.
sl@0
    34
When the refcount is zero (no controller threads left) the client deletes 
sl@0
    35
this class.
sl@0
    36
*/
sl@0
    37
sl@0
    38
const TInt KMMFControllerSharedHeapMaxSize = 0x1000000;//16MB
sl@0
    39
sl@0
    40
NONSHARABLE_CLASS(CMMFControllerHeap) : public CBase
sl@0
    41
	{
sl@0
    42
public:
sl@0
    43
	static CMMFControllerHeap* NewL();
sl@0
    44
	~CMMFControllerHeap();
sl@0
    45
sl@0
    46
	RHeap* RegisterHeap();
sl@0
    47
	TInt ReleaseHeap();
sl@0
    48
private:	
sl@0
    49
	void ConstructL();
sl@0
    50
private:
sl@0
    51
	RHeap*	iHeap;
sl@0
    52
	TInt	iRefCount;
sl@0
    53
	};
sl@0
    54
sl@0
    55
#endif