42 class MHTTPDataSupplier; |
42 class MHTTPDataSupplier; |
43 class CIdle; |
43 class CIdle; |
44 class CHttpCacheEvictionHandler; |
44 class CHttpCacheEvictionHandler; |
45 class THttpCacheEntry; |
45 class THttpCacheEntry; |
46 class CHttpCacheObserver; |
46 class CHttpCacheObserver; |
|
47 class CHttpCacheFileWriteHandler; |
47 |
48 |
48 // CLASS DECLARATION |
49 // CLASS DECLARATION |
|
50 |
|
51 NONSHARABLE_CLASS( THttpCachePostponeParameters ) |
|
52 { |
|
53 public: |
|
54 THttpCachePostponeParameters(); |
|
55 |
|
56 TBool iEnabled; |
|
57 TInt iFreeRamThreshold; |
|
58 TInt iImmediateWriteThreshold; |
|
59 TInt iWriteTimeout; |
|
60 }; |
|
61 |
|
62 NONSHARABLE_CLASS( TCompressedEntry ) |
|
63 { |
|
64 public: |
|
65 ~TCompressedEntry() { if(!IsCompressed()) delete iName.iNameAsHBuf; }; |
|
66 static TCompressedEntry *NewL( const TEntry& aEntry ); |
|
67 |
|
68 private: |
|
69 TCompressedEntry(){}; |
|
70 void ConstructL( const TEntry& aEntry ); |
|
71 enum { |
|
72 EFilenameStoredAsUint32 = 0x01 |
|
73 }; |
|
74 |
|
75 public: |
|
76 TBool IsCompressed() { return (iFlags && TCompressedEntry::EFilenameStoredAsUint32); }; |
|
77 static TBool ConvertANameToUint32( const TDesC& aName, TUint32& aConverted); |
|
78 static TInt ConvertAsciiToIntSingleHexDigit(const TUint16& aDigitChar); |
|
79 TUint32 GetSize() { return iSize; }; |
|
80 HBufC* GetNameL(); |
|
81 TUint32 GetCompressedName() { return iName.iNameAsUint32; }; |
|
82 |
|
83 private: |
|
84 TUint32 iFlags; |
|
85 TUint32 iSize; |
|
86 union { |
|
87 TUint32 iNameAsUint32; |
|
88 HBufC* iNameAsHBuf; |
|
89 }iName; |
|
90 }; |
|
91 |
|
92 NONSHARABLE_CLASS( CCustomCacheDirList ) : public CBase |
|
93 { |
|
94 public: |
|
95 static CCustomCacheDirList* NewL(CDir *aSrc); |
|
96 ~CCustomCacheDirList() { iDirList.ResetAndDestroy(); }; |
|
97 |
|
98 public: |
|
99 TBool ValidateCacheEntryL( const CHttpCacheEntry& aEntry ); |
|
100 TInt Count(); |
|
101 HBufC* NameAtL( TInt aIndex ); |
|
102 |
|
103 private: |
|
104 CCustomCacheDirList(); |
|
105 void ConstructL(CDir *aSrc); |
|
106 |
|
107 private: |
|
108 RPointerArray<TCompressedEntry> iDirList; |
|
109 }; |
|
110 |
|
111 NONSHARABLE_CLASS( CCacheDirectoryFiles ) : public CBase |
|
112 { |
|
113 public: |
|
114 static CCacheDirectoryFiles* NewL(RFs aRfs, const TDesC& aDir); |
|
115 static CCacheDirectoryFiles* NewLC(RFs aRfs, const TDesC& aDir); |
|
116 |
|
117 public: |
|
118 /* |
|
119 * Check to see if the entry passed in has a valid file in the directory listing |
|
120 * returns ETrue if file present and size matches entry |
|
121 * otherwise EFalse. |
|
122 * Removes matching files from stored list. |
|
123 */ |
|
124 TBool ValidateEntryL(const CHttpCacheEntry& aEntry); |
|
125 |
|
126 /* |
|
127 * Delete any files in the stored list from the filesystem |
|
128 * Intended to be called after you have validated all the entries |
|
129 * against the list - the content of the list will now only be the |
|
130 * orphan files in the cache subdirectories. |
|
131 * IMPORTANT: only call this once you've looked at all your entries. |
|
132 */ |
|
133 void RemoveLeftoverFilesL(); |
|
134 |
|
135 private: |
|
136 CCacheDirectoryFiles(RFs aRfs, const TDesC& aDir) : iRfs(aRfs), iDir(aDir) {}; |
|
137 ~CCacheDirectoryFiles(); |
|
138 void ConstructL(); |
|
139 |
|
140 private: |
|
141 RFs iRfs; |
|
142 const TDesC& iDir; |
|
143 |
|
144 RPointerArray<CCustomCacheDirList> iDirContent; |
|
145 }; |
49 |
146 |
50 /** |
147 /** |
51 * |
148 * |
52 * @lib |
149 * @lib |
53 * @since 3.1 |
150 * @since 3.1 |
61 * @since 3.1 |
158 * @since 3.1 |
62 * @param |
159 * @param |
63 * @param |
160 * @param |
64 * @return CacheHandler object. |
161 * @return CacheHandler object. |
65 */ |
162 */ |
66 static CHttpCacheHandler* NewL( TInt aSize, |
163 static CHttpCacheHandler* NewL( TInt aSize, |
67 const TDesC& aDirectory, |
164 const TDesC& aDirectory, |
68 const TDesC& aIndexFile, |
165 const TDesC& aIndexFile, |
69 TInt aCriticalLevel ); |
166 TInt aCriticalLevel, |
|
167 const THttpCachePostponeParameters& aPostpone); |
70 |
168 |
71 /** |
169 /** |
72 * Destructor. |
170 * Destructor. |
73 */ |
171 */ |
74 virtual ~CHttpCacheHandler(); |
172 virtual ~CHttpCacheHandler(); |
210 CHttpCacheHandler( TInt aSize ); |
317 CHttpCacheHandler( TInt aSize ); |
211 |
318 |
212 /** |
319 /** |
213 * By default Symbian 2nd phase constructor is private. |
320 * By default Symbian 2nd phase constructor is private. |
214 */ |
321 */ |
215 void ConstructL( const TDesC& aDirectory, const TDesC& aIndexFile, TInt aCriticalLevel); |
322 void ConstructL( const TDesC& aDirectory, const TDesC& aIndexFile, TInt aCriticalLevel, const THttpCachePostponeParameters& aPostpone); |
216 |
323 |
217 private: // |
324 private: // |
218 |
325 |
219 /** |
326 /** |
220 * Some other application modified the cache and the lookup table needs to be updated |
327 * Some other application modified the cache and the lookup table needs to be updated |
330 HBufC* iDirectory; // owned |
444 HBufC* iDirectory; // owned |
331 // name of the index file |
445 // name of the index file |
332 HBufC* iIndexFile; // owned |
446 HBufC* iIndexFile; // owned |
333 // Observing changes in cache |
447 // Observing changes in cache |
334 CHttpCacheObserver* iHttpCacheObserver; // owned |
448 CHttpCacheObserver* iHttpCacheObserver; // owned |
335 // An opened and configured file server session |
449 // An opened and configured file server session |
336 RFs iRfs; |
450 RFs iRfs; |
|
451 // |
|
452 CHttpCacheFileWriteHandler* iPostponeHandler; // owned |
337 }; |
453 }; |
338 |
454 |
339 #endif // CHTTPCACHEHANDLER_H |
455 #endif // CHTTPCACHEHANDLER_H |
340 |
456 |
341 // End of File |
457 // End of File |