sl@0
|
1 |
// Copyright (c) 2008-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 the License "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 |
// f32\sfile\sf_memory_client.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@internalTechnology
|
sl@0
|
21 |
@released
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#if !defined(__SF_MEMORY_CLIENT_H__)
|
sl@0
|
25 |
#define __SF_MEMORY_CLIENT_H__
|
sl@0
|
26 |
|
sl@0
|
27 |
#include "sf_memory_man.h"
|
sl@0
|
28 |
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
Cache memory client class, used by various caches as an interface to cache memory manager
|
sl@0
|
31 |
@see CCacheMemoryManager
|
sl@0
|
32 |
*/
|
sl@0
|
33 |
class CCacheMemoryClient : public CBase
|
sl@0
|
34 |
{
|
sl@0
|
35 |
public:
|
sl@0
|
36 |
IMPORT_C TUint8* AllocateAndLockSegments(TUint32 aSegmentCount);
|
sl@0
|
37 |
IMPORT_C TInt LockSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
|
sl@0
|
38 |
IMPORT_C TInt UnlockSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
|
sl@0
|
39 |
IMPORT_C TInt DecommitSegments(TUint8* aStartRamAddr, TUint32 aSegmentCount);
|
sl@0
|
40 |
IMPORT_C void Reset();
|
sl@0
|
41 |
|
sl@0
|
42 |
void SetBaseOffset(TUint32 aOffset);
|
sl@0
|
43 |
TInt Initialize();
|
sl@0
|
44 |
static CCacheMemoryClient* NewL(CCacheMemoryManager& aManager, const TDesC& aClientName, TUint32 aOffsetInBytes, TUint32 aMinSizeInSegs, TUint32 aMaxSizeInSegs);
|
sl@0
|
45 |
CCacheMemoryClient(CCacheMemoryManager& aManager, TUint32 aMinSizeInSegs, TUint32 aMaxSizeInSegs);
|
sl@0
|
46 |
~CCacheMemoryClient();
|
sl@0
|
47 |
TUint32 MaxSizeInBytes();
|
sl@0
|
48 |
const TDesC& Name() const;
|
sl@0
|
49 |
|
sl@0
|
50 |
private:
|
sl@0
|
51 |
void ConstructL(const TDesC& aClientName, TUint32 aOffsetInBytes);
|
sl@0
|
52 |
|
sl@0
|
53 |
private:
|
sl@0
|
54 |
CCacheMemoryManager& iManager; ///< reference of the cache memory manager it registers with
|
sl@0
|
55 |
HBufC* iName; ///< a unique identifier of the client
|
sl@0
|
56 |
TUint8* iBase; ///< the base address of the client memory space
|
sl@0
|
57 |
TUint32 iMinSizeInSegs; ///< the minimum size of the client in segments
|
sl@0
|
58 |
TUint32 iMaxSizeInSegs; ///< the maximum size of the client in segments
|
sl@0
|
59 |
|
sl@0
|
60 |
/** an indicator in segment number, indicates how many segments has been used,
|
sl@0
|
61 |
note this figure never decrease, unless it is reset when disconnection happens */
|
sl@0
|
62 |
TUint32 iTouchedRegionFlag;
|
sl@0
|
63 |
|
sl@0
|
64 |
/** an indicator in segment number, indicates how many segments should be reserved
|
sl@0
|
65 |
for permenently locked pages */
|
sl@0
|
66 |
TUint32 iReservedRegionMarkInSegs;
|
sl@0
|
67 |
|
sl@0
|
68 |
/** an array holds all the pages that can be reused, i.e. decommited pages */
|
sl@0
|
69 |
RArray<TUint8*> iReusablePagePool;
|
sl@0
|
70 |
|
sl@0
|
71 |
TUint32 iSegSizeInBytes;
|
sl@0
|
72 |
TUint iSegSizeInBytesLog2;
|
sl@0
|
73 |
friend class CCacheMemoryManager;
|
sl@0
|
74 |
};
|
sl@0
|
75 |
|
sl@0
|
76 |
#endif //__SF_MEMORY_CLIENT_H__
|