diff -r a359256acfc6 -r c8a366e56285 webengine/osswebengine/cache/inc/HttpCacheUtil.h --- a/webengine/osswebengine/cache/inc/HttpCacheUtil.h Thu Aug 27 07:44:59 2009 +0300 +++ b/webengine/osswebengine/cache/inc/HttpCacheUtil.h Thu Sep 24 12:53:48 2009 +0300 @@ -20,6 +20,7 @@ // INCLUDES #include +#include #include #include @@ -54,7 +55,11 @@ const TUint32 KFilenameLength = 8; _LIT( KHttpCacheHeaderExt, ".h" ); -#ifdef _DEBUG +const TInt KCacheFileNeedsDelete( 1 ); +const TInt KCacheFileNoDelete( 0 ); + + +#ifdef HTTP_CACHE_LOGGING #define __CACHELOG__ #endif @@ -70,7 +75,11 @@ class MHTTPDataSupplier; class RStringPool; class CHttpCacheEntry; +class CHttpCacheFileHash; +class TFileInfo; +typedef TPtrHashMapIter THttpCacheFileHashIter; +typedef RPtrHashMap RHttpCacheFileHashMap; // CLASS DECLARATION /** @@ -297,6 +306,25 @@ */ static void WriteUrlToLog( TInt aLogLevel, const TDesC& aTxt, const TDesC8& aUrl, TInt aAny = 0xffff ); + /** + * @since 7.1 + * + * example: + * CCacheFileHash *hash; + * GenerateCacheContentHashMapL(hash, rfs, _L("Cachelocation"), ); + * When you return, you should push onto the cleanup stack as usual. + * When you're finished with the hash just do: + * CleanupStack::PopAndDestroy(); to clean up both hash and string array. + */ + static void GenerateCacheContentHashMapL(CHttpCacheFileHash*& aHashMap, RFs& aRfs, const TDesC& aCacheFolder, const TInt aInitialValue); + + /** + * @since 7.1 + * + * Ensure trailing slash on paths + */ + static void EnsureTrailingSlash( TDes& aPath ); + private: /** @@ -334,6 +362,37 @@ char** aExtraValue ); }; +NONSHARABLE_CLASS( TFileInfo ) + { + public: + TInt iUserInt; + TUint32 iFileSize; + }; + +NONSHARABLE_CLASS( CHttpCacheFileHash ) : public CBase + { + friend class HttpCacheUtil; + protected: + static CHttpCacheFileHash* NewLC(const TInt aInitialValue); + void InsertAndStoreL(const TEntry& aEntry, const TDesC& aDir); + + private: + void ConstructL(); + CHttpCacheFileHash(const TInt aInitialValue, const THashFunction32& aHash, const TIdentityRelation& aIdentity); + + public: + ~CHttpCacheFileHash(); + RHttpCacheFileHashMap& HashMap() { return iHashMap; }; + + private: + RHttpCacheFileHashMap iHashMap; + RPointerArray iStringStorage; + CArrayFixSeg* iFileInfoStorage; + const TInt iInitialValue; + }; + + + #endif // CHTTPCACHEUTIL_H // End of File