Title: [182540] trunk/Source/WebKit
Revision
182540
Author
[email protected]
Date
2015-04-08 09:10:56 -0700 (Wed, 08 Apr 2015)

Log Message

Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=143504

Reviewed by Sam Weinig.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj:
Add WebApplicationCacheInternal.h.

Source/WebKit/mac:

Add a webApplicationCacheStorage() function and use it throughout WebKitLegacy.
In the future, webApplicationCacheStorage will return a custom singleton, but for now
it just returns ApplicationCacheStorage::singleton().

* Misc/WebCache.mm:
(+[WebCache empty]):
* WebCoreSupport/WebApplicationCache.mm:
(+[WebApplicationCache maximumSize]):
(+[WebApplicationCache setMaximumSize:]):
(+[WebApplicationCache defaultOriginQuota]):
(+[WebApplicationCache setDefaultOriginQuota:]):
(+[WebApplicationCache originsWithCache]):
(webApplicationCacheStorage):
* WebCoreSupport/WebApplicationCacheInternal.h: Added.
* WebCoreSupport/WebApplicationCacheQuotaManager.mm:
(-[WebApplicationCacheQuotaManager usage]):
(-[WebApplicationCacheQuotaManager quota]):
(-[WebApplicationCacheQuotaManager setQuota:]):
* WebView/WebView.mm:
(WebKitInitializeApplicationCachePathIfNecessary):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (182539 => 182540)


--- trunk/Source/WebKit/ChangeLog	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/ChangeLog	2015-04-08 16:10:56 UTC (rev 182540)
@@ -1,3 +1,13 @@
+2015-04-07  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
+        https://bugs.webkit.org/show_bug.cgi?id=143504
+
+        Reviewed by Sam Weinig.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        Add WebApplicationCacheInternal.h.
+
 2015-04-05  Gyuyoung Kim  <[email protected]>
 
         Use constants of sqlite3 directly for status of SQL result in webdatabase

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (182539 => 182540)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2015-04-08 16:10:56 UTC (rev 182540)
@@ -52,6 +52,7 @@
 		1A74A28F0F4F75400082E228 /* WebTextInputWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A74A28D0F4F75400082E228 /* WebTextInputWindowController.m */; };
 		1A77B02E0EE7730500C8A1F9 /* WebPluginRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */; };
 		1A77B02F0EE7730500C8A1F9 /* WebPluginRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A77B02D0EE7730500C8A1F9 /* WebPluginRequest.m */; };
+		1A86CCD41AD48A620074BA89 /* WebApplicationCacheInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */; };
 		1A8DED500EE88B8A00F25022 /* HostedNetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */; };
 		1A8DED510EE88B8A00F25022 /* HostedNetscapePluginStream.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */; };
 		1AA83F831A5C4AE400026EC6 /* WebDatabaseProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA83F811A5C4AE400026EC6 /* WebDatabaseProvider.cpp */; };
@@ -517,6 +518,7 @@
 		1A74A28D0F4F75400082E228 /* WebTextInputWindowController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = WebTextInputWindowController.m; sourceTree = "<group>"; };
 		1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginRequest.h; sourceTree = "<group>"; };
 		1A77B02D0EE7730500C8A1F9 /* WebPluginRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebPluginRequest.m; sourceTree = "<group>"; };
+		1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheInternal.h; sourceTree = "<group>"; };
 		1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostedNetscapePluginStream.h; sourceTree = "<group>"; };
 		1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HostedNetscapePluginStream.mm; sourceTree = "<group>"; };
 		1AA83F811A5C4AE400026EC6 /* WebDatabaseProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebDatabaseProvider.cpp; path = ../../Storage/WebDatabaseProvider.cpp; sourceTree = "<group>"; };
@@ -1587,6 +1589,7 @@
 				CEDA12D9152CBE6800D9E08D /* WebAlternativeTextClient.mm */,
 				B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
 				B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
+				1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */,
 				A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */,
 				A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */,
 				51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */,
@@ -1933,6 +1936,7 @@
 				939810A50824BF01008DF038 /* WebPDFRepresentation.h in Headers */,
 				939810A40824BF01008DF038 /* WebPDFView.h in Headers */,
 				1AA879B611CBE9BF003C664F /* WebPlatformStrategies.h in Headers */,
+				1A86CCD41AD48A620074BA89 /* WebApplicationCacheInternal.h in Headers */,
 				939810350824BF01008DF038 /* WebPlugin.h in Headers */,
 				939810360824BF01008DF038 /* WebPluginContainer.h in Headers */,
 				A10C1D801820303D0036883A /* WebMailDelegate.h in Headers */,

Modified: trunk/Source/WebKit/mac/ChangeLog (182539 => 182540)


--- trunk/Source/WebKit/mac/ChangeLog	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-04-08 16:10:56 UTC (rev 182540)
@@ -1,3 +1,31 @@
+2015-04-07  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
+        https://bugs.webkit.org/show_bug.cgi?id=143504
+
+        Reviewed by Sam Weinig.
+
+        Add a webApplicationCacheStorage() function and use it throughout WebKitLegacy.
+        In the future, webApplicationCacheStorage will return a custom singleton, but for now
+        it just returns ApplicationCacheStorage::singleton().
+
+        * Misc/WebCache.mm:
+        (+[WebCache empty]):
+        * WebCoreSupport/WebApplicationCache.mm:
+        (+[WebApplicationCache maximumSize]):
+        (+[WebApplicationCache setMaximumSize:]):
+        (+[WebApplicationCache defaultOriginQuota]):
+        (+[WebApplicationCache setDefaultOriginQuota:]):
+        (+[WebApplicationCache originsWithCache]):
+        (webApplicationCacheStorage):
+        * WebCoreSupport/WebApplicationCacheInternal.h: Added.
+        * WebCoreSupport/WebApplicationCacheQuotaManager.mm:
+        (-[WebApplicationCacheQuotaManager usage]):
+        (-[WebApplicationCacheQuotaManager quota]):
+        (-[WebApplicationCacheQuotaManager setQuota:]):
+        * WebView/WebView.mm:
+        (WebKitInitializeApplicationCachePathIfNecessary):
+
 2015-04-07  Brady Eidson  <[email protected]>
 
         ContextMenuItem refactoring

Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (182539 => 182540)


--- trunk/Source/WebKit/mac/Misc/WebCache.mm	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm	2015-04-08 16:10:56 UTC (rev 182540)
@@ -25,6 +25,7 @@
 
 #import "WebCache.h"
 
+#import "WebApplicationCacheInternal.h"
 #import "WebNSObjectExtras.h"
 #import "WebPreferences.h"
 #import "WebSystemInterface.h"
@@ -119,7 +120,7 @@
     [WebView _setCacheModel:cacheModel];
 
     // Empty the application cache.
-    WebCore::ApplicationCacheStorage::singleton().empty();
+    webApplicationCacheStorage().empty();
 
     // Empty the Cross-Origin Preflight cache
     WebCore::CrossOriginPreflightResultCache::singleton().empty();

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm (182539 => 182540)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2015-04-08 16:10:56 UTC (rev 182540)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import "WebApplicationCache.h"
+#import "WebApplicationCacheInternal.h"
 
 #import "WebSecurityOriginInternal.h"
 #import <WebCore/ApplicationCache.h>
@@ -53,7 +53,7 @@
     
     SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
 
-    ApplicationCacheStorage::singleton().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
+    webApplicationCacheStorage().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
     
     initialized = YES;
 }
@@ -61,24 +61,23 @@
 
 + (long long)maximumSize
 {
-    return ApplicationCacheStorage::singleton().maximumSize();
+    return webApplicationCacheStorage().maximumSize();
 }
 
 + (void)setMaximumSize:(long long)size
 {
-    auto& cacheStorage = ApplicationCacheStorage::singleton();
-    cacheStorage.deleteAllEntries();
-    cacheStorage.setMaximumSize(size);
+    webApplicationCacheStorage().deleteAllEntries();
+    webApplicationCacheStorage().setMaximumSize(size);
 }
 
 + (long long)defaultOriginQuota
 {
-    return ApplicationCacheStorage::singleton().defaultOriginQuota();
+    return webApplicationCacheStorage().defaultOriginQuota();
 }
 
 + (void)setDefaultOriginQuota:(long long)size
 {
-    ApplicationCacheStorage::singleton().setDefaultOriginQuota(size);
+    webApplicationCacheStorage().setDefaultOriginQuota(size);
 }
 
 + (long long)diskUsageForOrigin:(WebSecurityOrigin *)origin
@@ -99,7 +98,7 @@
 + (NSArray *)originsWithCache
 {
     HashSet<RefPtr<SecurityOrigin>> coreOrigins;
-    ApplicationCacheStorage::singleton().getOriginsWithCache(coreOrigins);
+    webApplicationCacheStorage().getOriginsWithCache(coreOrigins);
     
     NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease];
     
@@ -113,3 +112,8 @@
 }
 
 @end
+
+WebCore::ApplicationCacheStorage& webApplicationCacheStorage()
+{
+    return ApplicationCacheStorage::singleton();
+}

Copied: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheInternal.h (from rev 182497, trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm) (0 => 182540)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheInternal.h	                        (rev 0)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheInternal.h	2015-04-08 16:10:56 UTC (rev 182540)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebApplicationCache.h"
+
+namespace WebCore {
+class ApplicationCacheStorage;
+}
+
+WebCore::ApplicationCacheStorage& webApplicationCacheStorage();
+

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm (182539 => 182540)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm	2015-04-08 16:10:56 UTC (rev 182540)
@@ -25,6 +25,7 @@
 
 #import "WebApplicationCacheQuotaManager.h"
 
+#import "WebApplicationCacheInternal.h"
 #import "WebSecurityOriginInternal.h"
 #import <WebCore/ApplicationCacheStorage.h>
 
@@ -50,7 +51,7 @@
 - (unsigned long long)usage
 {
     long long usage;
-    if (ApplicationCacheStorage::singleton().calculateUsageForOrigin([_origin _core], usage))
+    if (webApplicationCacheStorage().calculateUsageForOrigin([_origin _core], usage))
         return usage;
     return 0;
 }
@@ -58,14 +59,14 @@
 - (unsigned long long)quota
 {
     long long quota;
-    if (ApplicationCacheStorage::singleton().calculateQuotaForOrigin([_origin _core], quota))
+    if (webApplicationCacheStorage().calculateQuotaForOrigin([_origin _core], quota))
         return quota;
     return 0;
 }
 
 - (void)setQuota:(unsigned long long)quota
 {
-    ApplicationCacheStorage::singleton().storeUpdatedQuotaForOrigin([_origin _core], quota);
+    webApplicationCacheStorage().storeUpdatedQuotaForOrigin([_origin _core], quota);
 }
 
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (182539 => 182540)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2015-04-08 15:59:06 UTC (rev 182539)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2015-04-08 16:10:56 UTC (rev 182540)
@@ -38,7 +38,7 @@
 #import "DictionaryPopupInfo.h"
 #import "StorageThread.h"
 #import "WebAlternativeTextClient.h"
-#import "WebApplicationCache.h"
+#import "WebApplicationCacheInternal.h"
 #import "WebBackForwardListInternal.h"
 #import "WebBaseNetscapePluginView.h"
 #import "WebCache.h"
@@ -744,7 +744,7 @@
 
     NSString* cacheDir = [NSString _webkit_localCacheDirectoryWithBundleIdentifier:appName];
 
-    ApplicationCacheStorage::singleton().setCacheDirectory(cacheDir);
+    webApplicationCacheStorage().setCacheDirectory(cacheDir);
     initialized = YES;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to