os/kernelhwsrv/kernel/eka/include/memmodel/epoc/mmubase/defrag.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/memmodel/epoc/mmubase/defrag.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,65 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\memmodel\epoc\mmubase\defrag.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __DEFRAG_H__
    1.22 +#define __DEFRAG_H__
    1.23 +
    1.24 +/******************************************************************************
    1.25 + * Base class for RAM defragmentation implementation
    1.26 + ******************************************************************************/
    1.27 +
    1.28 +struct SZone;
    1.29 +class DRamAllocator;
    1.30 +/**
    1.31 +@internalComponent
    1.32 +*/
    1.33 +class Defrag
    1.34 +	{
    1.35 +public:
    1.36 +	enum TPanic
    1.37 +		{
    1.38 +		EDfcQInitFailed=0,
    1.39 +		};
    1.40 +
    1.41 +public:
    1.42 +	
    1.43 +	// platform independent - defragbase.cpp
    1.44 +	Defrag();
    1.45 +	void Init3(DRamAllocator* aRamAllocator);
    1.46 +	static void DefragTask(TAny* aArg);
    1.47 +private:
    1.48 +	TInt GeneralDefrag(TRamDefragRequest* aRequest);
    1.49 +	TInt ClaimRamZone(TRamDefragRequest* aRequest);
    1.50 +	TInt EmptyRamZone(TRamDefragRequest* aRequest);
    1.51 +	TInt ClearZone(SZone& aZone, TUint aMaxRetries, TRamDefragRequest* aRequest);
    1.52 +	TInt ClearMovableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest);
    1.53 +	TInt ClearDiscardableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest, TUint* aMaxDiscard=NULL);
    1.54 +	static void Panic(TPanic aPanic);
    1.55 +
    1.56 +	// data
    1.57 +
    1.58 +private:
    1.59 +	TInt iDefragPriority;
    1.60 +	TDfcQue iTaskQ;
    1.61 +	DRamAllocator* iRamAllocator;
    1.62 +
    1.63 +	static Defrag* TheDefrag; // single instance of the defragmentor
    1.64 +
    1.65 +	friend class TRamDefragRequest;	// This needs access to iDefragPriority and iTaskQ
    1.66 +	};
    1.67 +
    1.68 +#endif