|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef AKN_ICON_SRV_CACHE_H |
|
21 #define AKN_ICON_SRV_CACHE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AknsSrvClient.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CAknIconServer; |
|
31 class CAknIconSrvIconItem; |
|
32 class CAknIconSrvPrecacheItem; |
|
33 class TResourceReader; |
|
34 class CAknsBitmapItemDef; |
|
35 |
|
36 // FUNCTION PROTOTYPES |
|
37 GLREF_C TInt PrecacheThreadFunction( TAny* aParameters ); |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Icon cache configuration (static and dynamic). |
|
43 */ |
|
44 NONSHARABLE_CLASS(CAknIconSrvCache) : public CBase |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 static CAknIconSrvCache* NewL( CAknIconServer& aServer ); |
|
49 virtual ~CAknIconSrvCache(); |
|
50 |
|
51 public: // New methods |
|
52 |
|
53 |
|
54 // Dynamic bitmap caching |
|
55 TBool CacheUnusedIcon( CAknIconSrvIconItem& aItem ); |
|
56 void RemoveIfCached( CAknIconSrvIconItem& aItem ); |
|
57 void DynamicToPrecache( CAknIconSrvIconItem& aItem ); |
|
58 // Other utility methods |
|
59 inline RThread PrecacheThread(); |
|
60 inline RPointerArray<CAknIconSrvPrecacheItem>& PrecacheItems(); |
|
61 |
|
62 |
|
63 void EnableCache( TBool aEnable ); |
|
64 |
|
65 // For debug only |
|
66 void ResetDynamicCache(); |
|
67 |
|
68 private: // New methods |
|
69 |
|
70 static TInt IconDataSize( CAknIconSrvIconItem& aItem ); |
|
71 |
|
72 CAknIconSrvCache( CAknIconServer& aServer ); |
|
73 void ConstructL(); |
|
74 void UpdateDynamicCacheSize(); |
|
75 |
|
76 private: // data |
|
77 |
|
78 |
|
79 TInt iConfiguredMaxDynamicCacheSize; |
|
80 TInt iMaxDynamicCacheSize; |
|
81 |
|
82 // Dynamic cache info |
|
83 TInt iDynamicCacheSize; |
|
84 RPointerArray<CAknIconSrvIconItem> iDynamicallyCached; |
|
85 |
|
86 // Precache info |
|
87 // size of all items in precache |
|
88 TInt iPrecacheSize; |
|
89 // items marked to be precached |
|
90 RPointerArray<CAknIconSrvIconItem> iPrecache; |
|
91 |
|
92 CAknIconServer& iServer; |
|
93 #ifdef PRECACHE2 |
|
94 RThread iPrecacheThread2; |
|
95 #endif |
|
96 |
|
97 |
|
98 }; |
|
99 |
|
100 |
|
101 #endif // AKN_ICON_SRV_CACHE_H |
|
102 |
|
103 // Enf of File |