Title: [176875] trunk/Source/WebKit2
Revision
176875
Author
[email protected]
Date
2014-12-05 14:43:44 -0800 (Fri, 05 Dec 2014)

Log Message

Move the website data store code to a new file
https://bugs.webkit.org/show_bug.cgi?id=139312

Reviewed by Tim Horton.

It's weird to have all the website data code in the API class, so move it to a new file.

* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::WebsiteDataStore):
(API::WebsiteDataStore::isNonPersistent):
(API::generateNonPersistentSessionID): Deleted.
* UIProcess/API/APIWebsiteDataStore.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/WebsiteData/WebsiteDataStore.cpp: Copied from Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp.
(WebKit::generateNonPersistentSessionID):
(WebKit::WebsiteDataStore::createNonPersistent):
(WebKit::WebsiteDataStore::create):
(WebKit::WebsiteDataStore::WebsiteDataStore):
(WebKit::WebsiteDataStore::~WebsiteDataStore):
* UIProcess/WebsiteData/WebsiteDataStore.h: Copied from Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h.
(WebKit::WebsiteDataStore::isNonPersistent):
(WebKit::WebsiteDataStore::sessionID):
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176874 => 176875)


--- trunk/Source/WebKit2/ChangeLog	2014-12-05 22:22:15 UTC (rev 176874)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-05 22:43:44 UTC (rev 176875)
@@ -1,3 +1,30 @@
+2014-12-05  Anders Carlsson  <[email protected]>
+
+        Move the website data store code to a new file
+        https://bugs.webkit.org/show_bug.cgi?id=139312
+
+        Reviewed by Tim Horton.
+
+        It's weird to have all the website data code in the API class, so move it to a new file.
+
+        * UIProcess/API/APIWebsiteDataStore.cpp:
+        (API::WebsiteDataStore::WebsiteDataStore):
+        (API::WebsiteDataStore::isNonPersistent):
+        (API::generateNonPersistentSessionID): Deleted.
+        * UIProcess/API/APIWebsiteDataStore.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp: Copied from Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp.
+        (WebKit::generateNonPersistentSessionID):
+        (WebKit::WebsiteDataStore::createNonPersistent):
+        (WebKit::WebsiteDataStore::create):
+        (WebKit::WebsiteDataStore::WebsiteDataStore):
+        (WebKit::WebsiteDataStore::~WebsiteDataStore):
+        * UIProcess/WebsiteData/WebsiteDataStore.h: Copied from Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h.
+        (WebKit::WebsiteDataStore::isNonPersistent):
+        (WebKit::WebsiteDataStore::sessionID):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2014-12-05  Tim Horton  <[email protected]>
 
         Keyboard input should be disabled in the preview popover

Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp (176874 => 176875)


--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp	2014-12-05 22:22:15 UTC (rev 176874)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp	2014-12-05 22:43:44 UTC (rev 176875)
@@ -26,18 +26,10 @@
 #include "config.h"
 #include "APIWebsiteDataStore.h"
 
-#include <WebCore/SessionID.h>
+#include "WebsiteDataStore.h"
 
 namespace API {
 
-static uint64_t generateNonPersistentSessionID()
-{
-    // FIXME: We count backwards here to not conflict with API::Session.
-    static uint64_t sessionID = std::numeric_limits<uint64_t>::max();
-
-    return --sessionID;
-}
-
 RefPtr<WebsiteDataStore> WebsiteDataStore::defaultDataStore()
 {
     static WebsiteDataStore* defaultDataStore = adoptRef(new WebsiteDataStore(defaultDataStoreConfiguration())).leakRef();
@@ -51,12 +43,12 @@
 }
 
 WebsiteDataStore::WebsiteDataStore()
-    : m_sessionID(WebCore::SessionID(generateNonPersistentSessionID()))
+    : m_websiteDataStore(WebKit::WebsiteDataStore::createNonPersistent())
 {
 }
 
-WebsiteDataStore::WebsiteDataStore(Configuration configuration)
-    : m_sessionID(WebCore::SessionID::defaultSessionID())
+WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration configuration)
+    : m_websiteDataStore(WebKit::WebsiteDataStore::create(WTF::move(configuration)))
 {
 }
 
@@ -66,7 +58,7 @@
 
 bool WebsiteDataStore::isNonPersistent()
 {
-    return m_sessionID.isEphemeral();
+    return m_websiteDataStore->isNonPersistent();
 }
 
 }

Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h (176874 => 176875)


--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h	2014-12-05 22:22:15 UTC (rev 176874)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h	2014-12-05 22:43:44 UTC (rev 176875)
@@ -27,6 +27,7 @@
 #define APIWebsiteDataStore_h
 
 #include "APIObject.h"
+#include "WebsiteDataStore.h"
 #include <WebCore/SessionID.h>
 #include <wtf/text/WTFString.h>
 
@@ -34,25 +35,21 @@
 
 class WebsiteDataStore final : public ObjectImpl<Object::Type::WebsiteDataStore> {
 public:
-    struct Configuration {
-        // FIXME: Add configuration parameters here.
-    };
-
     static RefPtr<WebsiteDataStore> defaultDataStore();
     static RefPtr<WebsiteDataStore> createNonPersistentDataStore();
     virtual ~WebsiteDataStore();
 
     bool isNonPersistent();
 
-    WebCore::SessionID sessionID() const { return m_sessionID; }
+    WebKit::WebsiteDataStore& websiteDataStore() { return *m_websiteDataStore; }
 
 private:
-    static Configuration defaultDataStoreConfiguration();
-
+    WebsiteDataStore(WebKit::WebsiteDataStore::Configuration);
     WebsiteDataStore();
-    WebsiteDataStore(Configuration);
 
-    WebCore::SessionID m_sessionID;
+    static WebKit::WebsiteDataStore::Configuration defaultDataStoreConfiguration();
+
+    RefPtr<WebKit::WebsiteDataStore> m_websiteDataStore;
 };
 
 }

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (176874 => 176875)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-12-05 22:22:15 UTC (rev 176874)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-12-05 22:43:44 UTC (rev 176875)
@@ -271,7 +271,7 @@
 
     webPageConfiguration.userContentController = [_configuration userContentController]->_userContentControllerProxy.get();
     webPageConfiguration.visitedLinkProvider = [_configuration _visitedLinkProvider]->_visitedLinkProvider.get();
-    webPageConfiguration.sessionID = [_configuration _websiteDataStore]->_websiteDataStore->sessionID();
+    webPageConfiguration.sessionID = [_configuration _websiteDataStore]->_websiteDataStore->websiteDataStore().sessionID();
 
     RefPtr<WebKit::WebPageGroup> pageGroup;
     NSString *groupIdentifier = configuration._groupIdentifier;

Copied: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (from rev 176870, trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp) (0 => 176875)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp	2014-12-05 22:43:44 UTC (rev 176875)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#include "config.h"
+#include "WebsiteDataStore.h"
+
+namespace WebKit {
+
+static WebCore::SessionID generateNonPersistentSessionID()
+{
+    // FIXME: We count backwards here to not conflict with API::Session.
+    static uint64_t sessionID = std::numeric_limits<uint64_t>::max();
+
+    return WebCore::SessionID(--sessionID);
+}
+
+RefPtr<WebsiteDataStore::WebsiteDataStore> WebsiteDataStore::createNonPersistent()
+{
+    return adoptRef(new WebsiteDataStore(generateNonPersistentSessionID()));
+}
+
+RefPtr<WebsiteDataStore> WebsiteDataStore::create(Configuration configuration)
+{
+    return adoptRef(new WebsiteDataStore(WTF::move(configuration)));
+}
+
+WebsiteDataStore::WebsiteDataStore(Configuration configuration)
+    : m_sessionID(WebCore::SessionID::defaultSessionID())
+{
+}
+
+WebsiteDataStore::WebsiteDataStore(WebCore::SessionID sessionID)
+    : m_sessionID(sessionID)
+{
+}
+
+WebsiteDataStore::~WebsiteDataStore()
+{
+}
+
+}

Copied: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (from rev 176870, trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h) (0 => 176875)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h	2014-12-05 22:43:44 UTC (rev 176875)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef WebsiteDataStore_h
+#define WebsiteDataStore_h
+
+#include <WebCore/SessionID.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+class WebsiteDataStore : public RefCounted<WebsiteDataStore> {
+public:
+    struct Configuration {
+    };
+    static RefPtr<WebsiteDataStore> createNonPersistent();
+    static RefPtr<WebsiteDataStore> create(Configuration);
+    virtual ~WebsiteDataStore();
+
+    bool isNonPersistent() const { return m_sessionID.isEphemeral(); }
+    WebCore::SessionID sessionID() const { return m_sessionID; }
+
+private:
+    explicit WebsiteDataStore(WebCore::SessionID);
+    explicit WebsiteDataStore(Configuration);
+
+    WebCore::SessionID m_sessionID;
+};
+
+}
+
+#endif // WebsiteDataStore_h

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (176874 => 176875)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-12-05 22:22:15 UTC (rev 176874)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-12-05 22:43:44 UTC (rev 176875)
@@ -253,6 +253,8 @@
 		1A4D664E18A3031B00D82E21 /* WKFrameInfoInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4D664D18A3031B00D82E21 /* WKFrameInfoInternal.h */; };
 		1A50DB66110A3D57000D3FE5 /* WebProcess.app in Copy Files */ = {isa = PBXBuildFile; fileRef = 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */; };
 		1A53C2A21A323004004E8C70 /* InjectedBundleCSSStyleDeclarationHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */; };
+		1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */; };
+		1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */; };
 		1A5B1C501898606F004FCF9B /* WKNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */; };
 		1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B1C4F1898606F004FCF9B /* WKNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		1A5B1C5418987EDF004FCF9B /* WebDocumentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */; };
@@ -2232,6 +2234,8 @@
 		1A4F976E100E7B6600637A18 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
 		1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebProcess.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		1A50F0F819199E42001ACD12 /* WebKit2.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKit2.xcconfig; sourceTree = "<group>"; };
+		1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsiteDataStore.cpp; sourceTree = "<group>"; };
+		1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteDataStore.h; sourceTree = "<group>"; };
 		1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigation.mm; sourceTree = "<group>"; };
 		1A5B1C4F1898606F004FCF9B /* WKNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigation.h; sourceTree = "<group>"; };
 		1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDocumentLoader.cpp; sourceTree = "<group>"; };
@@ -4261,6 +4265,23 @@
 			tabWidth = 8;
 			usesTabs = 0;
 		};
+		1A53C2A31A325691004E8C70 /* WebsiteData */ = {
+			isa = PBXGroup;
+			children = (
+				1A53C2A81A325724004E8C70 /* Cocoa */,
+				1A53C2A41A32569F004E8C70 /* WebsiteDataStore.cpp */,
+				1A53C2A51A32569F004E8C70 /* WebsiteDataStore.h */,
+			);
+			path = WebsiteData;
+			sourceTree = "<group>";
+		};
+		1A53C2A81A325724004E8C70 /* Cocoa */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = Cocoa;
+			sourceTree = "<group>";
+		};
 		1A6280CA19199754006AD9F9 /* WebKit2 Framework */ = {
 			isa = PBXGroup;
 			children = (
@@ -5832,6 +5853,7 @@
 				0F594793187B3B4C00437857 /* Scrolling */,
 				1A44B95816B73F8C00B7BBD8 /* Storage */,
 				1AAF089E192681AC00B6390C /* UserContent */,
+				1A53C2A31A325691004E8C70 /* WebsiteData */,
 				1AE52F8F19201DA700A1FA37 /* APIContextConfiguration.cpp */,
 				1AE52F9019201DA700A1FA37 /* APIContextConfiguration.h */,
 				BCF69FA11176D01400471A52 /* APINavigationData.cpp */,
@@ -7366,6 +7388,7 @@
 				2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */,
 				1A1DC340196346D700FF7059 /* LegacySessionStateCoding.h in Headers */,
 				2DA049B4180CCCD300AAFA9E /* PlatformCALayerRemote.h in Headers */,
+				1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
 				1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */,
 				1AB8A1EC1840080900E9AE69 /* WKPageLoaderClient.h in Headers */,
 				1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */,
@@ -9086,6 +9109,7 @@
 				1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
 				1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */,
 				1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */,
+				1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */,
 				0FCB4E5018BBE044000FCFC9 /* WKGeolocationProviderIOS.mm in Sources */,
 				1AC1336718565B5700F3EC05 /* UserData.cpp in Sources */,
 				1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to