Add a WebApplicationCache::storage() and use it instead of the WebCore singleton
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 19:28:34 +0000 (19:28 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 19:28:34 +0000 (19:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143525

Reviewed by Antti Koivisto.

* WebApplicationCache.cpp:
(WebApplicationCache::storage):
(WebApplicationCache::maximumSize):
(WebApplicationCache::setMaximumSize):
(WebApplicationCache::defaultOriginQuota):
(WebApplicationCache::setDefaultOriginQuota):
(WebApplicationCache::diskUsageForOrigin):
(WebApplicationCache::deleteAllApplicationCaches):
(WebApplicationCache::deleteCacheForOrigin):
(WebApplicationCache::originsWithCache):
* WebApplicationCache.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182559 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/win/ChangeLog
Source/WebKit/win/WebApplicationCache.cpp
Source/WebKit/win/WebApplicationCache.h

index a8a2565569daf1bbf585b021d8c96f694e7a30a4..755ba48ea694548f608a53f9f43804213427d77c 100644 (file)
@@ -1,3 +1,22 @@
+2015-04-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a WebApplicationCache::storage() and use it instead of the WebCore singleton
+        https://bugs.webkit.org/show_bug.cgi?id=143525
+
+        Reviewed by Antti Koivisto.
+
+        * WebApplicationCache.cpp:
+        (WebApplicationCache::storage):
+        (WebApplicationCache::maximumSize):
+        (WebApplicationCache::setMaximumSize):
+        (WebApplicationCache::defaultOriginQuota):
+        (WebApplicationCache::setDefaultOriginQuota):
+        (WebApplicationCache::diskUsageForOrigin):
+        (WebApplicationCache::deleteAllApplicationCaches):
+        (WebApplicationCache::deleteCacheForOrigin):
+        (WebApplicationCache::originsWithCache):
+        * WebApplicationCache.h:
+
 2015-04-01  Simon Fraser  <simon.fraser@apple.com>
 
         Fix Windows build.
index 0fbde1e112942473a62b37e39a2cabc59352972b..294cb1493d419e14478bcfacdc06e8c134f06e7e 100644 (file)
@@ -58,6 +58,11 @@ WebApplicationCache* WebApplicationCache::createInstance()
     return instance;
 }
 
+WebCore::ApplicationCacheStorage& WebApplicationCache::storage()
+{
+    return WebCore::ApplicationCacheStorage::singleton();
+}
+
 // IUnknown -------------------------------------------------------------------
 
 HRESULT WebApplicationCache::QueryInterface(REFIID riid, void** ppvObject)
@@ -95,15 +100,14 @@ HRESULT WebApplicationCache::maximumSize(long long* size)
     if (!size)
         return E_POINTER;
 
-    *size = WebCore::ApplicationCacheStorage::singleton().maximumSize();
+    *size = storage().maximumSize();
     return S_OK;
 }
 
 HRESULT WebApplicationCache::setMaximumSize(long long size)
 {
-    auto& cacheStorage = WebCore::ApplicationCacheStorage::singleton();
-    cacheStorage.deleteAllEntries();
-    cacheStorage.setMaximumSize(size);
+    storage().deleteAllEntries();
+    storage().setMaximumSize(size);
     return S_OK;
 }
 
@@ -112,13 +116,13 @@ HRESULT WebApplicationCache::defaultOriginQuota(long long* quota)
     if (!quota)
         return E_POINTER;
 
-    *quota = WebCore::ApplicationCacheStorage::singleton().defaultOriginQuota();
+    *quota = storage().defaultOriginQuota();
     return S_OK;
 }
 
 HRESULT WebApplicationCache::setDefaultOriginQuota(long long quota)
 {
-    WebCore::ApplicationCacheStorage::singleton().setDefaultOriginQuota(quota);
+    storage().setDefaultOriginQuota(quota);
     return S_OK;
 }
 
@@ -131,13 +135,13 @@ HRESULT WebApplicationCache::diskUsageForOrigin(IWebSecurityOrigin* origin, long
     if (!webSecurityOrigin)
         return E_FAIL;
 
-    *size = WebCore::ApplicationCache::diskUsageForOrigin(webSecurityOrigin->securityOrigin());
+    *size = storage().diskUsageForOrigin(*webSecurityOrigin->securityOrigin());
     return S_OK;
 }
 
 HRESULT WebApplicationCache::deleteAllApplicationCaches()
 {
-    WebCore::ApplicationCache::deleteAllCaches();
+    storage().deleteAllCaches();
     return S_OK;
 }
 
@@ -151,7 +155,7 @@ HRESULT WebApplicationCache::deleteCacheForOrigin(IWebSecurityOrigin* origin)
     if (!webSecurityOrigin)
         return E_FAIL;
 
-    WebCore::ApplicationCache::deleteCacheForOrigin(webSecurityOrigin->securityOrigin());
+    storage().deleteCacheForOrigin(*webSecurityOrigin->securityOrigin());
     return S_OK;
 }
 
@@ -161,7 +165,7 @@ HRESULT WebApplicationCache::originsWithCache(IPropertyBag** origins)
         return E_POINTER;
 
     HashSet<RefPtr<WebCore::SecurityOrigin>> coreOrigins;
-    WebCore::ApplicationCacheStorage::singleton().getOriginsWithCache(coreOrigins);
+    storage().getOriginsWithCache(coreOrigins);
 
     RetainPtr<CFMutableArrayRef> arrayItem = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, coreOrigins.size(), &MarshallingHelpers::kIUnknownArrayCallBacks));
 
index ae83b4d6d8133f4c25484a578933b974183aea59..2763b7ffc3d9d53c867b224ffc64e82fa643bace 100644 (file)
 
 #include "WebKit.h"
 
+namespace WebCore {
+class ApplicationCacheStorage;
+}
+
 class DECLSPEC_UUID("1119E970-4B13-4B9A-A049-41096104B689") WebApplicationCache : public IWebApplicationCache {
 public:
     static WebApplicationCache* createInstance();
+
+    WebCore::ApplicationCacheStorage& storage();
+
 protected:
     WebApplicationCache();
     ~WebApplicationCache();