sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\memmodel\epoc\mmubase\defrag.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __DEFRAG_H__ sl@0: #define __DEFRAG_H__ sl@0: sl@0: /****************************************************************************** sl@0: * Base class for RAM defragmentation implementation sl@0: ******************************************************************************/ sl@0: sl@0: struct SZone; sl@0: class DRamAllocator; sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: class Defrag sl@0: { sl@0: public: sl@0: enum TPanic sl@0: { sl@0: EDfcQInitFailed=0, sl@0: }; sl@0: sl@0: public: sl@0: sl@0: // platform independent - defragbase.cpp sl@0: Defrag(); sl@0: void Init3(DRamAllocator* aRamAllocator); sl@0: static void DefragTask(TAny* aArg); sl@0: private: sl@0: TInt GeneralDefrag(TRamDefragRequest* aRequest); sl@0: TInt ClaimRamZone(TRamDefragRequest* aRequest); sl@0: TInt EmptyRamZone(TRamDefragRequest* aRequest); sl@0: TInt ClearZone(SZone& aZone, TUint aMaxRetries, TRamDefragRequest* aRequest); sl@0: TInt ClearMovableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest); sl@0: TInt ClearDiscardableFromZone(SZone& aZone, TBool aBestEffort, TRamDefragRequest* aRequest, TUint* aMaxDiscard=NULL); sl@0: static void Panic(TPanic aPanic); sl@0: sl@0: // data sl@0: sl@0: private: sl@0: TInt iDefragPriority; sl@0: TDfcQue iTaskQ; sl@0: DRamAllocator* iRamAllocator; sl@0: sl@0: static Defrag* TheDefrag; // single instance of the defragmentor sl@0: sl@0: friend class TRamDefragRequest; // This needs access to iDefragPriority and iTaskQ sl@0: }; sl@0: sl@0: #endif