diff options
Diffstat (limited to 'WebCore/loader/appcache/ApplicationCacheGroup.h')
-rw-r--r-- | WebCore/loader/appcache/ApplicationCacheGroup.h | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.h b/WebCore/loader/appcache/ApplicationCacheGroup.h index 8df52cc..b5cdf7b 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,10 +28,6 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) -#include <wtf/Noncopyable.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> - #include "DOMApplicationCache.h" #include "KURL.h" #include "PlatformString.h" @@ -39,6 +35,10 @@ #include "ResourceHandleClient.h" #include "SharedBuffer.h" +#include <wtf/Noncopyable.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> + namespace WebCore { class ApplicationCache; @@ -46,6 +46,7 @@ class ApplicationCacheResource; class Document; class DocumentLoader; class Frame; +class SecurityOrigin; enum ApplicationCacheUpdateOption { ApplicationCacheUpdateWithBrowsingContext, @@ -66,13 +67,15 @@ public: static void selectCacheWithoutManifestURL(Frame*); const KURL& manifestURL() const { return m_manifestURL; } + const SecurityOrigin* origin() const { return m_origin.get(); } UpdateStatus updateStatus() const { return m_updateStatus; } + void setUpdateStatus(UpdateStatus status); void setStorageID(unsigned storageID) { m_storageID = storageID; } unsigned storageID() const { return m_storageID; } void clearStorageID(); - void update(Frame*, ApplicationCacheUpdateOption); // FIXME: Frame should not bee needed when updating witout browsing context. + void update(Frame*, ApplicationCacheUpdateOption); // FIXME: Frame should not be needed when updating without browsing context. void cacheDestroyed(ApplicationCache*); bool cacheIsBeingUpdated(const ApplicationCache* cache) const { return cache == m_cacheBeingUpdated; } @@ -91,9 +94,13 @@ public: bool isCopy() const { return m_isCopy; } private: - static void postListenerTask(ApplicationCacheHost::EventID, const HashSet<DocumentLoader*>&); - static void postListenerTask(ApplicationCacheHost::EventID, DocumentLoader*); + static void postListenerTask(ApplicationCacheHost::EventID id, const HashSet<DocumentLoader*>& set) { postListenerTask(id, 0, 0, set); } + static void postListenerTask(ApplicationCacheHost::EventID id, DocumentLoader* loader) { postListenerTask(id, 0, 0, loader); } + static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, const HashSet<DocumentLoader*>&); + static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, DocumentLoader*); + void scheduleReachedMaxAppCacheSizeCallback(); + void scheduleReachedOriginQuotaCallback(); PassRefPtr<ResourceHandle> createResourceHandle(const KURL&, ApplicationCacheResource* newestCachedResource); @@ -101,8 +108,11 @@ private: // the existing client callback cannot be used, so assume that any client that enables application cache also wants it to use credential storage. virtual bool shouldUseCredentialStorage(ResourceHandle*) { return true; } +#if ENABLE(INSPECTOR) + virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse&); +#endif virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); - virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived); + virtual void didReceiveData(ResourceHandle*, const char*, int length, int lengthReceived); virtual void didFinishLoading(ResourceHandle*); virtual void didFail(ResourceHandle*, const ResourceError&); @@ -110,11 +120,13 @@ private: void didReceiveManifestData(const char*, int); void didFinishLoadingManifest(); void didReachMaxAppCacheSize(); + void didReachOriginQuota(PassRefPtr<Frame> frame); void startLoadingEntry(); void deliverDelayedMainResources(); void checkIfLoadIsComplete(); void cacheUpdateFailed(); + void cacheUpdateFailedDueToOriginQuota(); void manifestNotFound(); void addEntry(const String&, unsigned type); @@ -124,6 +136,7 @@ private: void stopLoading(); KURL m_manifestURL; + RefPtr<SecurityOrigin> m_origin; UpdateStatus m_updateStatus; // This is the newest complete cache in the group. @@ -147,6 +160,10 @@ private: // The URLs and types of pending cache entries. typedef HashMap<String, unsigned> EntryMap; EntryMap m_pendingEntries; + + // The total number of items to be processed to update the cache group and the number that have been done. + int m_progressTotal; + int m_progressDone; // Frame used for fetching resources when updating. // FIXME: An update started by a particular frame should not stop if it is destroyed, but there are other frames associated with the same cache group. @@ -175,11 +192,20 @@ private: RefPtr<ResourceHandle> m_currentHandle; RefPtr<ApplicationCacheResource> m_currentResource; - + +#if ENABLE(INSPECTOR) + unsigned long m_currentResourceIdentifier; +#endif + RefPtr<ApplicationCacheResource> m_manifestResource; RefPtr<ResourceHandle> m_manifestHandle; + int64_t m_loadedSize; + int64_t m_availableSpaceInQuota; + bool m_originQuotaReached; + friend class ChromeClientCallbackTimer; + friend class OriginQuotaReachedCallbackTimer; }; } // namespace WebCore |