Title: [183294] trunk/Source/WebKit2
Revision
183294
Author
[email protected]
Date
2015-04-24 17:09:25 -0700 (Fri, 24 Apr 2015)

Log Message

Change _WKWebsiteDataStore to hold on to an internal WKWebsiteDataStore
https://bugs.webkit.org/show_bug.cgi?id=144171

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _websiteDataStore]):
(-[WKWebViewConfiguration _setWebsiteDataStore:]):
* UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
(-[_WKWebsiteDataStore initWithDataStore:]):
(+[_WKWebsiteDataStore defaultDataStore]):
(+[_WKWebsiteDataStore nonPersistentDataStore]):
(-[_WKWebsiteDataStore isNonPersistent]):
(-[_WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
(-[_WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:]):
(-[_WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h.
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (183293 => 183294)


--- trunk/Source/WebKit2/ChangeLog	2015-04-24 23:54:59 UTC (rev 183293)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-25 00:09:25 UTC (rev 183294)
@@ -1,3 +1,25 @@
+2015-04-24  Anders Carlsson  <[email protected]>
+
+        Change _WKWebsiteDataStore to hold on to an internal WKWebsiteDataStore
+        https://bugs.webkit.org/show_bug.cgi?id=144171
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration _websiteDataStore]):
+        (-[WKWebViewConfiguration _setWebsiteDataStore:]):
+        * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
+        * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
+        (-[_WKWebsiteDataStore initWithDataStore:]):
+        (+[_WKWebsiteDataStore defaultDataStore]):
+        (+[_WKWebsiteDataStore nonPersistentDataStore]):
+        (-[_WKWebsiteDataStore isNonPersistent]):
+        (-[_WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]):
+        (-[_WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:]):
+        (-[_WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:]):
+        * UIProcess/API/Cocoa/_WKWebsiteDataStoreInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h.
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-04-24  Tim Horton  <[email protected]>
 
         WKPDFView does not support password-protected PDFs

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (183293 => 183294)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2015-04-24 23:54:59 UTC (rev 183293)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm	2015-04-25 00:09:25 UTC (rev 183294)
@@ -35,7 +35,7 @@
 #import "WKWebViewContentProviderRegistry.h"
 #import "WeakObjCPtr.h"
 #import "_WKVisitedLinkProvider.h"
-#import "_WKWebsiteDataStore.h"
+#import "_WKWebsiteDataStoreInternal.h"
 #import <wtf/RetainPtr.h>
 
 #if PLATFORM(IOS)
@@ -220,12 +220,12 @@
 
 - (_WKWebsiteDataStore *)_websiteDataStore
 {
-    return (_WKWebsiteDataStore *)self.websiteDataStore;
+    return self.websiteDataStore ? adoptNS([[_WKWebsiteDataStore alloc] initWithDataStore:self.websiteDataStore]).autorelease() : nullptr;
 }
 
 - (void)_setWebsiteDataStore:(_WKWebsiteDataStore *)websiteDataStore
 {
-    self.websiteDataStore = websiteDataStore;
+    self.websiteDataStore = websiteDataStore ? websiteDataStore->_dataStore.get() : nullptr;
 }
 
 #pragma clang diagnostic pop

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h (183293 => 183294)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h	2015-04-24 23:54:59 UTC (rev 183293)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h	2015-04-25 00:09:25 UTC (rev 183294)
@@ -35,7 +35,7 @@
 
 
 WK_CLASS_DEPRECATED(10_10, WK_MAC_TBA, 8_0, WK_IOS_TBA, "Please use WKWebsiteDataStore instead")
-@interface _WKWebsiteDataStore : WKWebsiteDataStore
+@interface _WKWebsiteDataStore : NSObject
 
 + (_WKWebsiteDataStore *)defaultDataStore;
 + (_WKWebsiteDataStore *)nonPersistentDataStore;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm (183293 => 183294)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm	2015-04-24 23:54:59 UTC (rev 183293)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.mm	2015-04-25 00:09:25 UTC (rev 183294)
@@ -24,7 +24,7 @@
  */
 
 #import "config.h"
-#import "_WKWebsiteDataStore.h"
+#import "_WKWebsiteDataStoreInternal.h"
 
 #if WK_API_ENABLED
 
@@ -45,6 +45,16 @@
 
 @implementation _WKWebsiteDataStore
 
+- (instancetype)initWithDataStore:(WKWebsiteDataStore *)dataStore
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _dataStore = dataStore;
+
+    return self;
+}
+
 static RetainPtr<NSSet> toWKWebsiteDataTypes(_WKWebsiteDataTypes websiteDataTypes)
 {
     auto wkWebsiteDataTypes = adoptNS([[NSMutableSet alloc] init]);
@@ -67,32 +77,32 @@
 
 + (_WKWebsiteDataStore *)defaultDataStore
 {
-    return (_WKWebsiteDataStore *)[WKWebsiteDataStore defaultDataStore];
+    return adoptNS([[_WKWebsiteDataStore alloc] initWithDataStore:[WKWebsiteDataStore defaultDataStore]]).autorelease();
 }
 
 + (_WKWebsiteDataStore *)nonPersistentDataStore
 {
-    return (_WKWebsiteDataStore *)[WKWebsiteDataStore nonPersistentDataStore];
+    return adoptNS([[_WKWebsiteDataStore alloc] initWithDataStore:[WKWebsiteDataStore nonPersistentDataStore]]).autorelease();
 }
 
 - (BOOL)isNonPersistent
 {
-    return !self.persistent;
+    return ![_dataStore isPersistent];
 }
 
 - (void)fetchDataRecordsOfTypes:(WKWebsiteDataTypes)websiteDataTypes completionHandler:(void (^)(NSArray *))completionHandler
 {
-    [super fetchDataRecordsOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() completionHandler:completionHandler];
+    [_dataStore fetchDataRecordsOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() completionHandler:completionHandler];
 }
 
 - (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes forDataRecords:(NSArray *)dataRecords completionHandler:(void (^)(void))completionHandler
 {
-    [super removeDataOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() forDataRecords:dataRecords completionHandler:completionHandler];
+    [_dataStore removeDataOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() forDataRecords:dataRecords completionHandler:completionHandler];
 }
 
 - (void)removeDataOfTypes:(WKWebsiteDataTypes)websiteDataTypes modifiedSince:(NSDate *)date completionHandler:(void (^)(void))completionHandler
 {
-    [super removeDataOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() modifiedSince:date completionHandler:completionHandler];
+    [_dataStore removeDataOfTypes:toWKWebsiteDataTypes(websiteDataTypes).get() modifiedSince:date completionHandler:completionHandler];
 }
 
 @end

Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreInternal.h (from rev 183293, trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStore.h) (0 => 183294)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKWebsiteDataStoreInternal.h	2015-04-25 00:09:25 UTC (rev 183294)
@@ -0,0 +1,43 @@
+/*
+ * 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 "_WKWebsiteDataStore.h"
+
+#if WK_API_ENABLED
+
+#import <wtf/RetainPtr.h>
+
+@class WKWebsiteDataStore;
+
+@interface _WKWebsiteDataStore () {
+@package
+    RetainPtr<WKWebsiteDataStore> _dataStore;
+}
+
+- (instancetype)initWithDataStore:(WKWebsiteDataStore *)dataStore;
+
+@end
+
+#endif // WK_API_ENABLED

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (183293 => 183294)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-04-24 23:54:59 UTC (rev 183293)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-04-25 00:09:25 UTC (rev 183294)
@@ -256,6 +256,7 @@
 		1A4832D61A9CDF96008B4DFE /* WebsiteData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4832D41A9CDF96008B4DFE /* WebsiteData.cpp */; };
 		1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4832D51A9CDF96008B4DFE /* WebsiteData.h */; };
 		1A4832D91A9D1FD2008B4DFE /* WebsiteDataRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4832D81A9D1FD2008B4DFE /* WebsiteDataRecord.cpp */; };
+		1A4A93B71AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A93B61AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h */; };
 		1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
 		1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */; };
 		1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */; };
@@ -2376,6 +2377,7 @@
 		1A4832D41A9CDF96008B4DFE /* WebsiteData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteData.cpp; sourceTree = "<group>"; };
 		1A4832D51A9CDF96008B4DFE /* WebsiteData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteData.h; sourceTree = "<group>"; };
 		1A4832D81A9D1FD2008B4DFE /* WebsiteDataRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteDataRecord.cpp; sourceTree = "<group>"; };
+		1A4A93B61AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsiteDataStoreInternal.h; sourceTree = "<group>"; };
 		1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginModule.cpp; sourceTree = "<group>"; };
 		1A4A9C5412B816CF008FE984 /* NetscapePluginModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetscapePluginModule.h; sourceTree = "<group>"; };
 		1A4A9C9912B821CD008FE984 /* NetscapePluginModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginModuleMac.mm; sourceTree = "<group>"; };
@@ -4446,6 +4448,7 @@
 				1AFB4C6C1ADF0C7800B33339 /* _WKWebsiteDataRecord.h */,
 				1AFB4C701ADF155D00B33339 /* _WKWebsiteDataStore.h */,
 				1AFB4C6F1ADF155D00B33339 /* _WKWebsiteDataStore.mm */,
+				1A4A93B61AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h */,
 				BC59548815C7868500FD1E3E /* WebKit2.h */,
 				BCBAAC6C144E61910053F82F /* WKBrowsingContextController.h */,
 				BCBAAC6D144E61920053F82F /* WKBrowsingContextController.mm */,
@@ -7678,6 +7681,7 @@
 				F6113E25126CE1820057D0A7 /* APIUserContentURLPattern.h in Headers */,
 				7C89D2941A67122F003A5FDE /* APIUserScript.h in Headers */,
 				C5E1AFED16B21017006CC1F2 /* APIWebArchive.h in Headers */,
+				1A4A93B71AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h in Headers */,
 				C5E1AFEF16B21029006CC1F2 /* APIWebArchiveResource.h in Headers */,
 				1A4832C81A9BC13C008B4DFE /* APIWebsiteDataRecord.h in Headers */,
 				1A3635AA1A3144A300ED6197 /* APIWebsiteDataStore.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to