Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfile\sf_memory_client.h
24 #if !defined(__SF_MEMORY_CLIENT_H__)
25 #define __SF_MEMORY_CLIENT_H__
27 #include "sf_memory_man.h"
30 Cache memory client class, used by various caches as an interface to cache memory manager
31 @see CCacheMemoryManager
33 class CCacheMemoryClient : public CBase
36 IMPORT_C TUint8* AllocateAndLockSegments(TUint32 aSegmentCount);
37 IMPORT_C TInt LockSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
38 IMPORT_C TInt UnlockSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
39 IMPORT_C TInt DecommitSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
40 IMPORT_C void Reset();
42 void SetBaseOffset(TUint32 aOffset);
44 static CCacheMemoryClient* NewL(CCacheMemoryManager& aManager, const TDesC& aClientName, TUint32 aOffsetInBytes, TUint32 aMinSizeInSegs, TUint32 aMaxSizeInSegs);
45 CCacheMemoryClient(CCacheMemoryManager& aManager, TUint32 aMinSizeInSegs, TUint32 aMaxSizeInSegs);
46 ~CCacheMemoryClient();
47 TUint32 MaxSizeInBytes();
48 const TDesC& Name() const;
51 void ConstructL(const TDesC& aClientName, TUint32 aOffsetInBytes);
54 CCacheMemoryManager& iManager; ///< reference of the cache memory manager it registers with
55 HBufC* iName; ///< a unique identifier of the client
56 TUint8* iBase; ///< the base address of the client memory space
57 TUint32 iMinSizeInSegs; ///< the minimum size of the client in segments
58 TUint32 iMaxSizeInSegs; ///< the maximum size of the client in segments
60 /** an indicator in segment number, indicates how many segments has been used,
61 note this figure never decrease, unless it is reset when disconnection happens */
62 TUint32 iTouchedRegionFlag;
64 /** an indicator in segment number, indicates how many segments should be reserved
65 for permenently locked pages */
66 TUint32 iReservedRegionMarkInSegs;
68 /** an array holds all the pages that can be reused, i.e. decommited pages */
69 RArray<TUint8*> iReusablePagePool;
71 TUint32 iSegSizeInBytes;
72 TUint iSegSizeInBytesLog2;
73 friend class CCacheMemoryManager;
76 #endif //__SF_MEMORY_CLIENT_H__