ApplicationCacheStorage.h [plain text]
#ifndef ApplicationCacheStorage_h
#define ApplicationCacheStorage_h
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
#include "PlatformString.h"
#include "SQLiteDatabase.h"
#include "StringHash.h"
#include <wtf/HashCountedSet.h>
namespace WebCore {
class ApplicationCache;
class ApplicationCacheGroup;
class ApplicationCacheResource;
class KURL;
class ApplicationCacheStorage {
public:
void setCacheDirectory(const String&);
const String& cacheDirectory() const;
ApplicationCacheGroup* cacheGroupForURL(const KURL&); ApplicationCacheGroup* fallbackCacheGroupForURL(const KURL&);
ApplicationCacheGroup* findOrCreateCacheGroup(const KURL& manifestURL);
void cacheGroupDestroyed(ApplicationCacheGroup*);
void cacheGroupMadeObsolete(ApplicationCacheGroup*);
bool storeNewestCache(ApplicationCacheGroup*); void store(ApplicationCacheResource*, ApplicationCache*);
bool storeUpdatedType(ApplicationCacheResource*, ApplicationCache*);
void remove(ApplicationCache*);
void empty();
static bool storeCopyOfCache(const String& cacheDirectory, ApplicationCache*);
private:
PassRefPtr<ApplicationCache> loadCache(unsigned storageID);
ApplicationCacheGroup* loadCacheGroup(const KURL& manifestURL);
bool store(ApplicationCacheGroup*);
bool store(ApplicationCache*);
bool store(ApplicationCacheResource*, unsigned cacheStorageID);
void loadManifestHostHashes();
void verifySchemaVersion();
void openDatabase(bool createIfDoesNotExist);
bool executeStatement(SQLiteStatement&);
bool executeSQLCommand(const String&);
String m_cacheDirectory;
SQLiteDatabase m_database;
HashCountedSet<unsigned, AlreadyHashed> m_cacheHostSet;
typedef HashMap<String, ApplicationCacheGroup*> CacheGroupMap;
CacheGroupMap m_cachesInMemory; };
ApplicationCacheStorage& cacheStorage();
}
#endif // ENABLE(OFFLINE_WEB_APPLICATIONS)
#endif // ApplicationCacheStorage_h