0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// f32\sfile\sf_memory_client.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalTechnology
|
|
21 |
@released
|
|
22 |
*/
|
|
23 |
|
|
24 |
#if !defined(__SF_MEMORY_CLIENT_H__)
|
|
25 |
#define __SF_MEMORY_CLIENT_H__
|
|
26 |
|
|
27 |
#include "sf_memory_man.h"
|
|
28 |
|
|
29 |
/**
|
|
30 |
Cache memory client class, used by various caches as an interface to cache memory manager
|
|
31 |
@see CCacheMemoryManager
|
|
32 |
*/
|
|
33 |
class CCacheMemoryClient : public CBase
|
|
34 |
{
|
|
35 |
public:
|
|
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();
|
|
41 |
|
|
42 |
void SetBaseOffset(TUint32 aOffset);
|
|
43 |
TInt Initialize();
|
|
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;
|
|
49 |
|
|
50 |
private:
|
|
51 |
void ConstructL(const TDesC& aClientName, TUint32 aOffsetInBytes);
|
|
52 |
|
|
53 |
private:
|
|
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
|
|
59 |
|
|
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;
|
|
63 |
|
|
64 |
/** an indicator in segment number, indicates how many segments should be reserved
|
|
65 |
for permenently locked pages */
|
|
66 |
TUint32 iReservedRegionMarkInSegs;
|
|
67 |
|
|
68 |
/** an array holds all the pages that can be reused, i.e. decommited pages */
|
|
69 |
RArray<TUint8*> iReusablePagePool;
|
|
70 |
|
|
71 |
TUint32 iSegSizeInBytes;
|
|
72 |
TUint iSegSizeInBytesLog2;
|
|
73 |
friend class CCacheMemoryManager;
|
|
74 |
};
|
|
75 |
|
|
76 |
#endif //__SF_MEMORY_CLIENT_H__
|