More work on UI side local storage
https://bugs.webkit.org/show_bug.cgi?id=108119
Reviewed by Beth Dakin.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Storage/StorageNamespaceProxy.cpp:
(WebKit::StorageNamespaceProxy::createSessionStorageNamespace):
Rename create to createSessionStorageNamespace and make it take a WebPage.
(WebKit::StorageNamespaceProxy::StorageNamespaceProxy):
Add WebPage parameter.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::sessionStorageNamespace):
Add an #ifdef for enabling UI side storage.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::page):
Call new WebPage::fromCorePage helper.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::fromCorePage):
Add new function for getting a WebPage from a WebCore::Page.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index b73efc7..a040462 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,30 @@
+2013-01-28 Anders Carlsson <andersca@apple.com>
+
+ More work on UI side local storage
+ https://bugs.webkit.org/show_bug.cgi?id=108119
+
+ Reviewed by Beth Dakin.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/Storage/StorageNamespaceProxy.cpp:
+ (WebKit::StorageNamespaceProxy::createSessionStorageNamespace):
+ Rename create to createSessionStorageNamespace and make it take a WebPage.
+
+ (WebKit::StorageNamespaceProxy::StorageNamespaceProxy):
+ Add WebPage parameter.
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::sessionStorageNamespace):
+ Add an #ifdef for enabling UI side storage.
+
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::page):
+ Call new WebPage::fromCorePage helper.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::fromCorePage):
+ Add new function for getting a WebPage from a WebCore::Page.
+
2013-01-28 Joseph Pecoraro <pecoraro@apple.com>
Improve PageVisibility API with enums
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index d848a64..eb25908 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -74,7 +74,6 @@
1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; };
1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A13BEB11635A9C800F19C03 /* StringReference.cpp */; };
1A13BEB41635A9C800F19C03 /* StringReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A13BEB21635A9C800F19C03 /* StringReference.h */; };
- 1A17635616B1D5D000D88FD6 /* StorageNamespaceProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A17635416B1D5D000D88FD6 /* StorageNamespaceProxy.cpp */; };
1A17977F137EE82C00F97D45 /* PluginCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A17977D137EE82C00F97D45 /* PluginCreationParameters.cpp */; };
1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A17977E137EE82C00F97D45 /* PluginCreationParameters.h */; };
1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A186EE812EF7618008E5F37 /* LayerTreeHost.h */; };
@@ -132,6 +131,7 @@
1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */; };
1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */; };
1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A433F0C113C53DD00FACDE9 /* WebErrors.h */; };
+ 1A44B95716B737AA00B7BBD8 /* StorageNamespaceProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A17635416B1D5D000D88FD6 /* StorageNamespaceProxy.cpp */; };
1A4A9AA812B7E796008FE984 /* WKTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A9AA612B7E796008FE984 /* WKTextInputWindowController.h */; };
1A4A9AA912B7E796008FE984 /* WKTextInputWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9AA712B7E796008FE984 /* WKTextInputWindowController.mm */; };
1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4A9C5312B816CF008FE984 /* NetscapePluginModule.cpp */; };
@@ -5873,7 +5873,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 1A17635616B1D5D000D88FD6 /* StorageNamespaceProxy.cpp in Sources */,
BC82837616B3674B00A278FE /* WebContentProcessMainBootstrapper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -6008,6 +6007,7 @@
1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
+ 1A44B95716B737AA00B7BBD8 /* StorageNamespaceProxy.cpp in Sources */,
1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */,
diff --git a/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp b/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp
index 3feeabc..7d346a9 100644
--- a/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp
+++ b/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp
@@ -27,18 +27,20 @@
#include "StorageNamespaceProxy.h"
#include "StorageAreaProxy.h"
+#include "WebPage.h"
#include <WebCore/SecurityOrigin.h>
using namespace WebCore;
namespace WebKit {
-PassRefPtr<StorageNamespaceProxy> StorageNamespaceProxy::create()
+PassRefPtr<StorageNamespaceProxy> StorageNamespaceProxy::createSessionStorageNamespace(WebPage* webPage)
{
- return adoptRef(new StorageNamespaceProxy);
+ return adoptRef(new StorageNamespaceProxy(webPage));
}
-StorageNamespaceProxy::StorageNamespaceProxy()
+StorageNamespaceProxy::StorageNamespaceProxy(WebPage* webPage)
+ : m_storageNamespaceID(webPage->pageID())
{
}
diff --git a/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h b/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h
index 83ca4f5..0047981 100644
--- a/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h
+++ b/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h
@@ -31,14 +31,15 @@
namespace WebKit {
+class WebPage;
+
class StorageNamespaceProxy : public WebCore::StorageNamespace {
public:
- // FIXME: Figure out what else to pass here.
- static PassRefPtr<StorageNamespaceProxy> create();
+ static PassRefPtr<StorageNamespaceProxy> createSessionStorageNamespace(WebPage*);
virtual ~StorageNamespaceProxy();
private:
- StorageNamespaceProxy();
+ explicit StorageNamespaceProxy(WebPage*);
virtual PassRefPtr<WebCore::StorageArea> storageArea(PassRefPtr<WebCore::SecurityOrigin>) OVERRIDE;
virtual PassRefPtr<WebCore::StorageNamespace> copy() OVERRIDE;
@@ -47,6 +48,8 @@
virtual void clearAllOriginsForDeletion() OVERRIDE;
virtual void sync() OVERRIDE;
virtual void closeIdleLocalStorageDatabases() OVERRIDE;
+
+ uint64_t m_storageNamespaceID;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index 3527a05..154f305 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -32,10 +32,12 @@
#include "DataReference.h"
#include "NetworkResourceLoadParameters.h"
#include "PluginInfoStore.h"
+#include "StorageNamespaceProxy.h"
#include "WebContextMessages.h"
#include "WebCookieManager.h"
#include "WebCoreArgumentCoders.h"
#include "WebErrors.h"
+#include "WebPage.h"
#include "WebProcess.h"
#include "WebProcessProxyMessages.h"
#include <WebCore/Color.h>
@@ -56,6 +58,9 @@
#include "WebResourceLoadScheduler.h"
#endif
+// FIXME: Remove this once it works well enough to be the default.
+#define ENABLE_UI_PROCESS_STORAGE 0
+
using namespace WebCore;
namespace WebKit {
@@ -310,7 +315,11 @@
PassRefPtr<StorageNamespace> WebPlatformStrategies::sessionStorageNamespace(Page* page, unsigned quota)
{
- return sessionStorageNamespace(page, quota);
+#if ENABLE(UI_PROCESS_STORAGE)
+ return StorageNamespaceProxy::createSessionStorageNamespace(WebPage::fromCorePage(page));
+#else
+ return StorageStrategy::sessionStorageNamespace(page, quota);
+#endif
}
// VisitedLinkStrategy
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 8efca5c..deeaf77 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -185,8 +185,8 @@
if (!m_coreFrame)
return 0;
- if (WebCore::Page* page = m_coreFrame->page())
- return static_cast<WebChromeClient*>(page->chrome()->client())->page();
+ if (Page* page = m_coreFrame->page())
+ return WebPage::fromCorePage(page);
return 0;
}
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 7e1cd65..2f81505 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -976,6 +976,11 @@
}
}
+WebPage* WebPage::fromCorePage(Page* page)
+{
+ return static_cast<WebChromeClient*>(page->chrome()->client())->page();
+}
+
void WebPage::setSize(const WebCore::IntSize& viewSize)
{
FrameView* view = m_page->mainFrame()->view();
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index bb6620e..486ce2a 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -179,6 +179,8 @@
void close();
+ static WebPage* fromCorePage(WebCore::Page*);
+
WebCore::Page* corePage() const { return m_page.get(); }
uint64_t pageID() const { return m_pageID; }