os/kernelhwsrv/kernel/eka/include/memmodel/epoc/mmubase/defrag.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 the License "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 // e32\include\memmodel\epoc\mmubase\defrag.h
    15 // 
    16 //
    17 
    18 #ifndef __DEFRAG_H__
    19 #define __DEFRAG_H__
    20 
    21 /******************************************************************************
    22  * Base class for RAM defragmentation implementation
    23  ******************************************************************************/
    24 
    25 struct SZone;
    26 class DRamAllocator;
    27 /**
    28 @internalComponent
    29 */
    30 class Defrag
    31 	{
    32 public:
    33 	enum TPanic
    34 		{
    35 		EDfcQInitFailed=0,
    36 		};
    37 
    38 public:
    39 	
    40 	// platform independent - defragbase.cpp
    41 	Defrag();
    42 	void Init3(DRamAllocator* aRamAllocator);
    43 	static void DefragTask(TAny* aArg);
    44 private:
    45 	TInt GeneralDefrag(TRamDefragRequest* aRequest);
    46 	TInt ClaimRamZone(TRamDefragRequest* aRequest);
    47 	TInt EmptyRamZone(TRamDefragRequest* aRequest);
    48 	TInt ClearZone(SZone& aZone, TUint aMaxRetries, TRamDefragRequest* aRequest);
    49 	TInt ClearMovableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest);
    50 	TInt ClearDiscardableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest, TUint* aMaxDiscard=NULL);
    51 	static void Panic(TPanic aPanic);
    52 
    53 	// data
    54 
    55 private:
    56 	TInt iDefragPriority;
    57 	TDfcQue iTaskQ;
    58 	DRamAllocator* iRamAllocator;
    59 
    60 	static Defrag* TheDefrag; // single instance of the defragmentor
    61 
    62 	friend class TRamDefragRequest;	// This needs access to iDefragPriority and iTaskQ
    63 	};
    64 
    65 #endif