Title: [199836] trunk/Source/WebKit/win
Revision
199836
Author
ander...@apple.com
Date
2016-04-21 14:16:54 -0700 (Thu, 21 Apr 2016)

Log Message

Stop using ApplicationCacheStorage::singleton() on Windows
https://bugs.webkit.org/show_bug.cgi?id=156861

Reviewed by Darin Adler.

* WebApplicationCache.cpp:
(applicationCachePath):
(WebApplicationCache::storage):
* WebApplicationCache.h:
* WebCache.cpp:
(WebCache::empty):
* WebView.cpp:
(WebView::initWithFrame):
(WebKitSetApplicationCachePathIfNecessary): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/win/ChangeLog (199835 => 199836)


--- trunk/Source/WebKit/win/ChangeLog	2016-04-21 21:08:20 UTC (rev 199835)
+++ trunk/Source/WebKit/win/ChangeLog	2016-04-21 21:16:54 UTC (rev 199836)
@@ -1,3 +1,20 @@
+2016-04-21  Anders Carlsson  <ander...@apple.com>
+
+        Stop using ApplicationCacheStorage::singleton() on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=156861
+
+        Reviewed by Darin Adler.
+
+        * WebApplicationCache.cpp:
+        (applicationCachePath):
+        (WebApplicationCache::storage):
+        * WebApplicationCache.h:
+        * WebCache.cpp:
+        (WebCache::empty):
+        * WebView.cpp:
+        (WebView::initWithFrame):
+        (WebKitSetApplicationCachePathIfNecessary): Deleted.
+
 2016-04-15  Brent Fulgham  <bfulg...@apple.com>
 
         CSP: Make dynamically-added favicons (via link rel="icon") obey Content-Security-Policy

Modified: trunk/Source/WebKit/win/WebApplicationCache.cpp (199835 => 199836)


--- trunk/Source/WebKit/win/WebApplicationCache.cpp	2016-04-21 21:08:20 UTC (rev 199835)
+++ trunk/Source/WebKit/win/WebApplicationCache.cpp	2016-04-21 21:16:54 UTC (rev 199836)
@@ -58,9 +58,24 @@
     return instance;
 }
 
+static String applicationCachePath()
+{
+    String path = localUserSpecificStorageDirectory();
+
+#if USE(CF)
+    autocacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
+    if (cacheDirectoryPreference && CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get()))
+        path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
+#endif
+
+    return path;
+}
+
 WebCore::ApplicationCacheStorage& WebApplicationCache::storage()
 {
-    return WebCore::ApplicationCacheStorage::singleton();
+    static ApplicationCacheStorage& storage = ApplicationCacheStorage::create(applicationCachePath(), "ApplicationCache").leakRef();
+
+    return storage;
 }
 
 // IUnknown -------------------------------------------------------------------

Modified: trunk/Source/WebKit/win/WebApplicationCache.h (199835 => 199836)


--- trunk/Source/WebKit/win/WebApplicationCache.h	2016-04-21 21:08:20 UTC (rev 199835)
+++ trunk/Source/WebKit/win/WebApplicationCache.h	2016-04-21 21:16:54 UTC (rev 199836)
@@ -36,7 +36,7 @@
 public:
     static WebApplicationCache* createInstance();
 
-    WebCore::ApplicationCacheStorage& storage();
+    static WebCore::ApplicationCacheStorage& storage();
 
 protected:
     WebApplicationCache();

Modified: trunk/Source/WebKit/win/WebCache.cpp (199835 => 199836)


--- trunk/Source/WebKit/win/WebCache.cpp	2016-04-21 21:08:20 UTC (rev 199835)
+++ trunk/Source/WebKit/win/WebCache.cpp	2016-04-21 21:16:54 UTC (rev 199836)
@@ -27,6 +27,7 @@
 #include "WebCache.h"
 
 #include "CFDictionaryPropertyBag.h"
+#include "WebApplicationCache.h"
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/BString.h>
 #include <WebCore/MemoryCache.h>
@@ -214,7 +215,7 @@
     memoryCache.setDisabled(false);
 
     // Empty the application cache.
-    WebCore::ApplicationCacheStorage::singleton().empty();
+    WebApplicationCache::storage().empty();
 
     // Empty the Cross-Origin Preflight cache
     WebCore::CrossOriginPreflightResultCache::singleton().empty();

Modified: trunk/Source/WebKit/win/WebView.cpp (199835 => 199836)


--- trunk/Source/WebKit/win/WebView.cpp	2016-04-21 21:08:20 UTC (rev 199835)
+++ trunk/Source/WebKit/win/WebView.cpp	2016-04-21 21:16:54 UTC (rev 199836)
@@ -37,6 +37,7 @@
 #include "SoftLinking.h"
 #include "SubframeLoader.h"
 #include "TextIterator.h"
+#include "WebApplicationCache.h"
 #include "WebBackForwardList.h"
 #include "WebChromeClient.h"
 #include "WebContextMenuClient.h"
@@ -2828,26 +2829,6 @@
     return E_NOTIMPL;
 }
 
-static void WebKitSetApplicationCachePathIfNecessary()
-{
-    static bool initialized = false;
-    if (initialized)
-        return;
-
-    String path = localUserSpecificStorageDirectory();
-
-#if USE(CF)
-    RetainPtr<CFPropertyListRef> cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
-    if (cacheDirectoryPreference && (CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get())))
-        path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
-#endif
-
-    if (!path.isNull())
-        ApplicationCacheStorage::singleton().setCacheDirectory(path);
-
-    initialized = true;
-}
-
 bool WebView::shouldInitializeTrackPointHack()
 {
     static bool shouldCreateScrollbars;
@@ -2916,7 +2897,6 @@
         WebPlatformStrategies::initialize();
 
         WebKitInitializeWebDatabasesIfNecessary();
-        WebKitSetApplicationCachePathIfNecessary();
 
         MemoryPressureHandler::singleton().install();
 
@@ -2936,6 +2916,7 @@
     configuration.dragClient = new WebDragClient(this);
     configuration.inspectorClient = m_inspectorClient;
     configuration.loaderClientForMainFrame = new WebFrameLoaderClient;
+    configuration.applicationCacheStorage = &WebApplicationCache::storage();
     configuration.databaseProvider = &WebDatabaseProvider::singleton();
     configuration.storageNamespaceProvider = &m_webViewGroup->storageNamespaceProvider();
     configuration.progressTrackerClient = static_cast<WebFrameLoaderClient*>(configuration.loaderClientForMainFrame);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to