Commit e44d33f5 authored by andersca@apple.com's avatar andersca@apple.com

Change storage factory functions to take a PageGroup and Page respectively

https://bugs.webkit.org/show_bug.cgi?id=114776

Reviewed by Beth Dakin.

Source/WebCore:

Change StorageNamespace::localStorageNamespace to take a PageGroup since WebKit2 needs
to know which local storage namespace belongs to which page group. Also remove the quota parameter from
the sessionStorageNamespace function since that's trivial to get from the Page.

* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::sessionStorage):
* page/PageGroup.cpp:
(WebCore::PageGroup::localStorage):
* storage/StorageNamespace.cpp:
(WebCore::StorageNamespace::localStorageNamespace):
(WebCore::StorageNamespace::sessionStorageNamespace):
* storage/StorageNamespace.h:
* storage/StorageNamespaceImpl.cpp:
(WebCore::StorageNamespaceImpl::localStorageNamespace):
(WebCore::StorageNamespaceImpl::sessionStorageNamespace):
* storage/StorageNamespaceImpl.h:
* storage/StorageStrategy.cpp:
(WebCore::StorageStrategy::localStorageNamespace):
(WebCore::StorageStrategy::sessionStorageNamespace):
* storage/StorageStrategy.h:

Source/WebKit2:

Update for WebCore changes.

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::localStorageNamespace):
(WebKit::WebPlatformStrategies::sessionStorageNamespace):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
(WebPlatformStrategies):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 248f4b3a
2013-04-17 Anders Carlsson <andersca@apple.com>
Change storage factory functions to take a PageGroup and Page respectively
https://bugs.webkit.org/show_bug.cgi?id=114776
Reviewed by Beth Dakin.
Change StorageNamespace::localStorageNamespace to take a PageGroup since WebKit2 needs
to know which local storage namespace belongs to which page group. Also remove the quota parameter from
the sessionStorageNamespace function since that's trivial to get from the Page.
* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::sessionStorage):
* page/PageGroup.cpp:
(WebCore::PageGroup::localStorage):
* storage/StorageNamespace.cpp:
(WebCore::StorageNamespace::localStorageNamespace):
(WebCore::StorageNamespace::sessionStorageNamespace):
* storage/StorageNamespace.h:
* storage/StorageNamespaceImpl.cpp:
(WebCore::StorageNamespaceImpl::localStorageNamespace):
(WebCore::StorageNamespaceImpl::sessionStorageNamespace):
* storage/StorageNamespaceImpl.h:
* storage/StorageStrategy.cpp:
(WebCore::StorageStrategy::localStorageNamespace):
(WebCore::StorageStrategy::sessionStorageNamespace):
* storage/StorageStrategy.h:
2013-04-18 Martin Robinson <mrobinson@igalia.com> 2013-04-18 Martin Robinson <mrobinson@igalia.com>
[GTK] fast/canvas/DrawImageSinglePixelStretch.html fails [GTK] fast/canvas/DrawImageSinglePixelStretch.html fails
...@@ -472,8 +472,8 @@ __ZN7WebCore15ResourceRequest21httpPipeliningEnabledEv ...@@ -472,8 +472,8 @@ __ZN7WebCore15ResourceRequest21httpPipeliningEnabledEv
__ZN7WebCore15ResourceRequest24setHTTPPipeliningEnabledEb __ZN7WebCore15ResourceRequest24setHTTPPipeliningEnabledEb
__ZN7WebCore15ScrollAlignment17alignCenterAlwaysE __ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
__ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE __ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE
__ZN7WebCore15StorageStrategy21localStorageNamespaceERKN3WTF6StringEj __ZN7WebCore15StorageStrategy21localStorageNamespaceEPNS_9PageGroupE
__ZN7WebCore15StorageStrategy23sessionStorageNamespaceEPNS_4PageEj __ZN7WebCore15StorageStrategy23sessionStorageNamespaceEPNS_4PageE
__ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE __ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE
__ZN7WebCore15StringTruncator14centerTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE __ZN7WebCore15StringTruncator14centerTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE
__ZN7WebCore15StringTruncator5widthERKN3WTF6StringERKNS_4FontENS0_24EnableRoundingHacksOrNotE __ZN7WebCore15StringTruncator5widthERKN3WTF6StringERKNS_4FontENS0_24EnableRoundingHacksOrNotE
......
...@@ -1087,7 +1087,7 @@ void Page::setDebugger(JSC::Debugger* debugger) ...@@ -1087,7 +1087,7 @@ void Page::setDebugger(JSC::Debugger* debugger)
StorageNamespace* Page::sessionStorage(bool optionalCreate) StorageNamespace* Page::sessionStorage(bool optionalCreate)
{ {
if (!m_sessionStorage && optionalCreate) if (!m_sessionStorage && optionalCreate)
m_sessionStorage = StorageNamespace::sessionStorageNamespace(this, m_settings->sessionStorageQuota()); m_sessionStorage = StorageNamespace::sessionStorageNamespace(this);
return m_sessionStorage.get(); return m_sessionStorage.get();
} }
......
...@@ -257,16 +257,8 @@ void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack) ...@@ -257,16 +257,8 @@ void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack)
StorageNamespace* PageGroup::localStorage() StorageNamespace* PageGroup::localStorage()
{ {
if (!m_localStorage) { if (!m_localStorage)
// Need a page in this page group to query the settings for the local storage database path. m_localStorage = StorageNamespace::localStorageNamespace(this);
// Having these parameters attached to the page settings is unfortunate since these settings are
// not per-page (and, in fact, we simply grab the settings from some page at random), but
// at this point we're stuck with it.
Page* page = *m_pages.begin();
const String& path = page->settings()->localStorageDatabasePath();
unsigned quota = m_groupSettings->localStorageQuotaBytes();
m_localStorage = StorageNamespace::localStorageNamespace(path, quota);
}
return m_localStorage.get(); return m_localStorage.get();
} }
......
...@@ -35,22 +35,22 @@ ...@@ -35,22 +35,22 @@
namespace WebCore { namespace WebCore {
PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(const String& path, unsigned quota) PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(PageGroup* pageGroup)
{ {
#if USE(PLATFORM_STRATEGIES) #if USE(PLATFORM_STRATEGIES)
return platformStrategies()->storageStrategy()->localStorageNamespace(path, quota); return platformStrategies()->storageStrategy()->localStorageNamespace(pageGroup);
#else #else
return StorageNamespaceImpl::localStorageNamespace(path, quota); return StorageNamespaceImpl::localStorageNamespace(pageGroup);
#endif #endif
} }
PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* page, unsigned quota) PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace(Page* page)
{ {
#if USE(PLATFORM_STRATEGIES) #if USE(PLATFORM_STRATEGIES)
return platformStrategies()->storageStrategy()->sessionStorageNamespace(page, quota); return platformStrategies()->storageStrategy()->sessionStorageNamespace(page);
#else #else
UNUSED_PARAM(page); UNUSED_PARAM(page);
return StorageNamespaceImpl::sessionStorageNamespace(quota); return StorageNamespaceImpl::sessionStorageNamespace(page);
#endif #endif
} }
......
...@@ -33,13 +33,14 @@ ...@@ -33,13 +33,14 @@
namespace WebCore { namespace WebCore {
class Page; class Page;
class PageGroup;
class SecurityOrigin; class SecurityOrigin;
class StorageArea; class StorageArea;
class StorageNamespace : public RefCounted<StorageNamespace> { class StorageNamespace : public RefCounted<StorageNamespace> {
public: public:
static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path, unsigned quota); static PassRefPtr<StorageNamespace> localStorageNamespace(PageGroup*);
static PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*, unsigned quota); static PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*);
virtual ~StorageNamespace() { } virtual ~StorageNamespace() { }
virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) = 0; virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) = 0;
......
...@@ -26,7 +26,11 @@ ...@@ -26,7 +26,11 @@
#include "config.h" #include "config.h"
#include "StorageNamespaceImpl.h" #include "StorageNamespaceImpl.h"
#include "GroupSettings.h"
#include "Page.h"
#include "PageGroup.h"
#include "SecurityOriginHash.h" #include "SecurityOriginHash.h"
#include "Settings.h"
#include "StorageAreaImpl.h" #include "StorageAreaImpl.h"
#include "StorageMap.h" #include "StorageMap.h"
#include "StorageSyncManager.h" #include "StorageSyncManager.h"
...@@ -45,22 +49,30 @@ static LocalStorageNamespaceMap& localStorageNamespaceMap() ...@@ -45,22 +49,30 @@ static LocalStorageNamespaceMap& localStorageNamespaceMap()
return localStorageNamespaceMap; return localStorageNamespaceMap;
} }
PassRefPtr<StorageNamespace> StorageNamespaceImpl::localStorageNamespace(const String& path, unsigned quota) PassRefPtr<StorageNamespace> StorageNamespaceImpl::localStorageNamespace(PageGroup* pageGroup)
{ {
// Need a page in this page group to query the settings for the local storage database path.
// Having these parameters attached to the page settings is unfortunate since these settings are
// not per-page (and, in fact, we simply grab the settings from some page at random), but
// at this point we're stuck with it.
Page* page = *pageGroup->pages().begin();
const String& path = page->settings()->localStorageDatabasePath();
unsigned quota = pageGroup->groupSettings()->localStorageQuotaBytes();
const String lookupPath = path.isNull() ? emptyString() : path; const String lookupPath = path.isNull() ? emptyString() : path;
LocalStorageNamespaceMap::iterator it = localStorageNamespaceMap().find(lookupPath);
if (it == localStorageNamespaceMap().end()) { LocalStorageNamespaceMap::AddResult result = localStorageNamespaceMap().add(lookupPath, 0);
if (!result.isNewEntry)
return result.iterator->value;
RefPtr<StorageNamespace> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, lookupPath, quota)); RefPtr<StorageNamespace> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, lookupPath, quota));
localStorageNamespaceMap().set(lookupPath, storageNamespace.get());
return storageNamespace.release();
}
return it->value; result.iterator->value = storageNamespace.get();
return storageNamespace.release();
} }
PassRefPtr<StorageNamespace> StorageNamespaceImpl::sessionStorageNamespace(unsigned quota) PassRefPtr<StorageNamespace> StorageNamespaceImpl::sessionStorageNamespace(Page* page)
{ {
return adoptRef(new StorageNamespaceImpl(SessionStorage, String(), quota)); return adoptRef(new StorageNamespaceImpl(SessionStorage, String(), page->settings()->sessionStorageQuota()));
} }
StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path, unsigned quota) StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path, unsigned quota)
......
...@@ -39,8 +39,8 @@ class StorageAreaImpl; ...@@ -39,8 +39,8 @@ class StorageAreaImpl;
class StorageNamespaceImpl : public StorageNamespace { class StorageNamespaceImpl : public StorageNamespace {
public: public:
static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path, unsigned quota); static PassRefPtr<StorageNamespace> localStorageNamespace(PageGroup*);
static PassRefPtr<StorageNamespace> sessionStorageNamespace(unsigned quota); static PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*);
virtual ~StorageNamespaceImpl(); virtual ~StorageNamespaceImpl();
virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) OVERRIDE; virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) OVERRIDE;
......
...@@ -32,14 +32,14 @@ ...@@ -32,14 +32,14 @@
namespace WebCore { namespace WebCore {
PassRefPtr<StorageNamespace> StorageStrategy::localStorageNamespace(const String& path, unsigned quota) PassRefPtr<StorageNamespace> StorageStrategy::localStorageNamespace(PageGroup* pageGroup)
{ {
return StorageNamespaceImpl::localStorageNamespace(path, quota); return StorageNamespaceImpl::localStorageNamespace(pageGroup);
} }
PassRefPtr<StorageNamespace> StorageStrategy::sessionStorageNamespace(Page*, unsigned quota) PassRefPtr<StorageNamespace> StorageStrategy::sessionStorageNamespace(Page* page)
{ {
return StorageNamespaceImpl::sessionStorageNamespace(quota); return StorageNamespaceImpl::sessionStorageNamespace(page);
} }
} // namespace WebCore } // namespace WebCore
......
...@@ -33,12 +33,13 @@ ...@@ -33,12 +33,13 @@
namespace WebCore { namespace WebCore {
class Page; class Page;
class PageGroup;
class StorageNamespace; class StorageNamespace;
class StorageStrategy { class StorageStrategy {
public: public:
virtual PassRefPtr<StorageNamespace> localStorageNamespace(const String& path, unsigned quota); virtual PassRefPtr<StorageNamespace> localStorageNamespace(PageGroup*);
virtual PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*, unsigned quota); virtual PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*);
protected: protected:
virtual ~StorageStrategy() virtual ~StorageStrategy()
......
2013-04-17 Anders Carlsson <andersca@apple.com>
Change storage factory functions to take a PageGroup and Page respectively
https://bugs.webkit.org/show_bug.cgi?id=114776
Reviewed by Beth Dakin.
Update for WebCore changes.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::localStorageNamespace):
(WebKit::WebPlatformStrategies::sessionStorageNamespace):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
(WebPlatformStrategies):
2013-04-18 Timothy Hatcher <timothy@apple.com> 2013-04-18 Timothy Hatcher <timothy@apple.com>
Remove an ASSERT that is causing flakeyness in Debug builds. Remove an ASSERT that is causing flakeyness in Debug builds.
...@@ -298,17 +298,17 @@ void WebPlatformStrategies::populatePluginCache() ...@@ -298,17 +298,17 @@ void WebPlatformStrategies::populatePluginCache()
// StorageStrategy // StorageStrategy
PassRefPtr<StorageNamespace> WebPlatformStrategies::localStorageNamespace(const String& path, unsigned quota) PassRefPtr<StorageNamespace> WebPlatformStrategies::localStorageNamespace(PageGroup* pageGroup)
{ {
return StorageStrategy::localStorageNamespace(path, quota); return StorageStrategy::localStorageNamespace(pageGroup);
} }
PassRefPtr<StorageNamespace> WebPlatformStrategies::sessionStorageNamespace(Page* page, unsigned quota) PassRefPtr<StorageNamespace> WebPlatformStrategies::sessionStorageNamespace(Page* page)
{ {
#if ENABLE(UI_PROCESS_STORAGE) #if ENABLE(UI_PROCESS_STORAGE)
return StorageNamespaceImpl::createSessionStorageNamespace(WebPage::fromCorePage(page)); return StorageNamespaceImpl::createSessionStorageNamespace(WebPage::fromCorePage(page));
#else #else
return StorageStrategy::sessionStorageNamespace(page, quota); return StorageStrategy::sessionStorageNamespace(page);
#endif #endif
} }
......
...@@ -84,8 +84,8 @@ private: ...@@ -84,8 +84,8 @@ private:
virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) OVERRIDE; virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) OVERRIDE;
// WebCore::StorageStrategy. // WebCore::StorageStrategy.
virtual PassRefPtr<WebCore::StorageNamespace> localStorageNamespace(const String& path, unsigned quota) OVERRIDE; virtual PassRefPtr<WebCore::StorageNamespace> localStorageNamespace(WebCore::PageGroup*) OVERRIDE;
virtual PassRefPtr<WebCore::StorageNamespace> sessionStorageNamespace(WebCore::Page*, unsigned quota) OVERRIDE; virtual PassRefPtr<WebCore::StorageNamespace> sessionStorageNamespace(WebCore::Page*) OVERRIDE;
// WebCore::VisitedLinkStrategy // WebCore::VisitedLinkStrategy
virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE; virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::KURL& baseURL, const WTF::AtomicString& attributeURL) OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment