diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/loader/appcache/ApplicationCache.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/loader/appcache/ApplicationCache.h')
-rw-r--r-- | Source/WebCore/loader/appcache/ApplicationCache.h | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/Source/WebCore/loader/appcache/ApplicationCache.h b/Source/WebCore/loader/appcache/ApplicationCache.h index 680635def..5df5f6017 100644 --- a/Source/WebCore/loader/appcache/ApplicationCache.h +++ b/Source/WebCore/loader/appcache/ApplicationCache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,45 +23,35 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ApplicationCache_h -#define ApplicationCache_h +#pragma once #include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> #include <wtf/text/StringHash.h> -#include <wtf/text/WTFString.h> namespace WebCore { class ApplicationCacheGroup; class ApplicationCacheResource; -class DocumentLoader; -class URL; class ResourceRequest; -class SecurityOrigin; +class URL; -typedef Vector<std::pair<URL, URL>> FallbackURLVector; +using FallbackURLVector = Vector<std::pair<URL, URL>>; class ApplicationCache : public RefCounted<ApplicationCache> { public: - static PassRefPtr<ApplicationCache> create() { return adoptRef(new ApplicationCache); } - - static void deleteCacheForOrigin(SecurityOrigin*); - + static Ref<ApplicationCache> create() { return adoptRef(*new ApplicationCache); } + ~ApplicationCache(); - void addResource(PassRefPtr<ApplicationCacheResource> resource); - unsigned removeResource(const String& url); - - void setManifestResource(PassRefPtr<ApplicationCacheResource> manifest); + void addResource(Ref<ApplicationCacheResource>&&); + + void setManifestResource(Ref<ApplicationCacheResource>&&); ApplicationCacheResource* manifestResource() const { return m_manifest; } - + void setGroup(ApplicationCacheGroup*); ApplicationCacheGroup* group() const { return m_group; } - bool isComplete() const; + bool isComplete(); ApplicationCacheResource* resourceForRequest(const ResourceRequest&); ApplicationCacheResource* resourceForURL(const String& url); @@ -74,45 +64,39 @@ public: void setFallbackURLs(const FallbackURLVector&); const FallbackURLVector& fallbackURLs() const { return m_fallbackURLs; } - bool urlMatchesFallbackNamespace(const URL&, URL* fallbackURL = 0); - + bool urlMatchesFallbackNamespace(const URL&, URL* fallbackURL = nullptr); + #ifndef NDEBUG void dump(); #endif - typedef HashMap<String, RefPtr<ApplicationCacheResource>> ResourceMap; - ResourceMap::const_iterator begin() const { return m_resources.begin(); } - ResourceMap::const_iterator end() const { return m_resources.end(); } - + using ResourceMap = HashMap<String, RefPtr<ApplicationCacheResource>>; + const ResourceMap& resources() const { return m_resources; } + void setStorageID(unsigned storageID) { m_storageID = storageID; } unsigned storageID() const { return m_storageID; } void clearStorageID(); - + static bool requestIsHTTPOrHTTPSGet(const ResourceRequest&); - static int64_t diskUsageForOrigin(SecurityOrigin*); - int64_t estimatedSizeInStorage() const { return m_estimatedSizeInStorage; } private: ApplicationCache(); - - ApplicationCacheGroup* m_group; + + ApplicationCacheGroup* m_group { nullptr }; ResourceMap m_resources; - ApplicationCacheResource* m_manifest; + ApplicationCacheResource* m_manifest { nullptr }; - bool m_allowAllNetworkRequests; + bool m_allowAllNetworkRequests { false }; Vector<URL> m_onlineWhitelist; FallbackURLVector m_fallbackURLs; // The total size of the resources belonging to this Application Cache instance. - // This is an estimation of the size this Application Cache occupies in the - // database file. - int64_t m_estimatedSizeInStorage; + // This is an estimation of the size this Application Cache occupies in the database file. + int64_t m_estimatedSizeInStorage { 0 }; - unsigned m_storageID; + unsigned m_storageID { 0 }; }; } // namespace WebCore - -#endif // ApplicationCache_h |