Commit fb151e40 authored by jorlow@chromium.org's avatar jorlow@chromium.org

2010-08-13 Jeremy Orlow <jorlow@chromium.org>

        Some settings are linked to the PageGroup not the Page.  Create a new class for those.
        https://bugs.webkit.org/show_bug.cgi?id=43794

        Since persistient storage is shared between pages, there's no way to modify
        some settings related to it on a per page basis.  As such, it's not technically
        correct for these settings to be on the Page's settings.  Create a new class
        called GroupSettings, move  group-wide local storage setting there (the other we
        can't), and add a new setting for IndexedDB's path (which is prompting this change).

        No behavior has changed, so no tests.

        * Android.mk:
        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * page/GroupSettings.cpp: Added.
        (WebCore::GroupSettings::GroupSettings):
        (WebCore::GroupSettings::setLocalStorageQuotaBytes):
        (WebCore::GroupSettings::setLocalStorageDatabasePath):
        (WebCore::GroupSettings::setIndexedDBDatabasePath):
        * page/GroupSettings.h: Added.
        (WebCore::GroupSettings::create):
        (WebCore::GroupSettings::localStorageQuotaBytes):
        (WebCore::GroupSettings::localStorageDatabasePath):
        (WebCore::GroupSettings::indexedDBDatabasePath):
        * page/PageGroup.cpp:
        (WebCore::PageGroup::PageGroup):
        (WebCore::PageGroup::localStorage):
        * page/PageGroup.h:
        (WebCore::PageGroup::groupSettings):
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::setSessionStorageQuota):
        * page/Settings.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65405 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54fd9e62
......@@ -372,6 +372,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
page/FrameView.cpp \
page/Geolocation.cpp \
page/GeolocationPositionCache.cpp \
page/GroupSettings.cpp \
page/History.cpp \
page/Location.cpp \
page/MouseEventWithHitTestResults.cpp \
......
......@@ -1163,6 +1163,7 @@ SET(WebCore_SOURCES
page/Geolocation.cpp
page/GeolocationController.cpp
page/GeolocationPositionCache.cpp
page/GroupSettings.cpp
page/History.cpp
page/Location.cpp
page/MemoryInfo.cpp
......
2010-08-13 Jeremy Orlow <jorlow@chromium.org>
Some settings are linked to the PageGroup not the Page. Create a new class for those.
https://bugs.webkit.org/show_bug.cgi?id=43794
Since persistient storage is shared between pages, there's no way to modify
some settings related to it on a per page basis. As such, it's not technically
correct for these settings to be on the Page's settings. Create a new class
called GroupSettings, move group-wide local storage setting there (the other we
can't), and add a new setting for IndexedDB's path (which is prompting this change).
No behavior has changed, so no tests.
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* page/GroupSettings.cpp: Added.
(WebCore::GroupSettings::GroupSettings):
(WebCore::GroupSettings::setLocalStorageQuotaBytes):
(WebCore::GroupSettings::setLocalStorageDatabasePath):
(WebCore::GroupSettings::setIndexedDBDatabasePath):
* page/GroupSettings.h: Added.
(WebCore::GroupSettings::create):
(WebCore::GroupSettings::localStorageQuotaBytes):
(WebCore::GroupSettings::localStorageDatabasePath):
(WebCore::GroupSettings::indexedDBDatabasePath):
* page/PageGroup.cpp:
(WebCore::PageGroup::PageGroup):
(WebCore::PageGroup::localStorage):
* page/PageGroup.h:
(WebCore::PageGroup::groupSettings):
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setSessionStorageQuota):
* page/Settings.h:
2010-08-16 Adam Barth <abarth@webkit.org>
Reviewed by Alexey Proskuryakov.
......@@ -1802,6 +1802,7 @@ webcore_sources += \
WebCore/page/GeolocationPositionCache.cpp \
WebCore/page/GeolocationPositionCache.h \
WebCore/page/Geoposition.h \
WebCore/page/GroupSettings.h \
WebCore/page/HaltablePlugin.h \
WebCore/page/History.cpp \
WebCore/page/History.h \
......
......@@ -2020,6 +2020,8 @@
'page/GeolocationPositionCache.cpp',
'page/GeolocationPositionCache.h',
'page/Geoposition.h',
'page/GroupSettings.cpp',
'page/GroupSettings.h',
'page/HaltablePlugin.h',
'page/History.cpp',
'page/History.h',
......
......@@ -835,6 +835,7 @@ SOURCES += \
page/Geolocation.cpp \
page/GeolocationController.cpp \
page/GeolocationPositionCache.cpp \
page/GroupSettings.cpp \
page/History.cpp \
page/Location.cpp \
page/MemoryInfo.cpp \
......@@ -1614,6 +1615,7 @@ HEADERS += \
page/Geolocation.h \
page/GeolocationPositionCache.h \
page/Geoposition.h \
page/GroupSettings.h \
page/HaltablePlugin.h \
page/History.h \
page/Location.h \
......
......@@ -22316,6 +22316,14 @@
RelativePath="..\page\Geoposition.h"
>
</File>
<File
RelativePath="..\page\GroupSettings.cpp"
>
</File>
<File
RelativePath="..\page\GroupSettings.h"
>
</File>
<File
RelativePath="..\page\HaltablePlugin.h"
>
......@@ -4963,6 +4963,8 @@
C0DFC8700DB6841A003EAE7C /* JSConsoleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */; };
C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; };
C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; };
C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */; };
C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = C50D0E810FF4272900AC2644 /* StorageNamespace.h */; };
C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */; };
......@@ -10724,6 +10726,8 @@
C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsoleCustom.cpp; sourceTree = "<group>"; };
C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingDetectorICU.cpp; sourceTree = "<group>"; };
C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEncodingDetector.h; sourceTree = "<group>"; };
C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = "<group>"; };
C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespace.cpp; sourceTree = "<group>"; };
C50D0E810FF4272900AC2644 /* StorageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespace.h; sourceTree = "<group>"; };
C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageSyncManager.h; sourceTree = "<group>"; };
......@@ -12535,6 +12539,8 @@
596229791133EFE200DC4CBB /* GeolocationPositionCache.h */,
FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */,
FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */,
C50B561412119D23008B46E0 /* GroupSettings.cpp */,
C50B561512119D23008B46E0 /* GroupSettings.h */,
7693BACE106C2DCA007B0823 /* HaltablePlugin.h */,
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
......@@ -20175,6 +20181,7 @@
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
C50B561712119D23008B46E0 /* GroupSettings.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -22604,6 +22611,7 @@
93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/*
* Copyright (C) 2010 Google 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 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 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 "GroupSettings.h"
namespace WebCore {
GroupSettings::GroupSettings()
: m_localStorageQuotaBytes(5 * 1024 * 1024) // Suggested by the HTML5 spec.
{
}
void GroupSettings::setLocalStorageQuotaBytes(unsigned quota)
{
m_localStorageQuotaBytes = quota;
}
void GroupSettings::setIndexedDBDatabasePath(const String& path)
{
m_indexedDBDatabasePath = path;
}
} // namespace WebCore
/*
* Copyright (C) 2010 Google 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 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 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 GroupSettings_h
#define GroupSettings_h
#include "PlatformString.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class PageGroup;
class GroupSettings : public Noncopyable {
public:
static PassOwnPtr<GroupSettings> create()
{
return adoptPtr(new GroupSettings());
}
void setLocalStorageQuotaBytes(unsigned);
unsigned localStorageQuotaBytes() const { return m_localStorageQuotaBytes; }
void setIndexedDBDatabasePath(const String&);
const String& indexedDBDatabasePath() const { return m_indexedDBDatabasePath; }
private:
GroupSettings();
unsigned m_localStorageQuotaBytes;
String m_indexedDBDatabasePath;
};
} // namespace WebCore
#endif // GroupSettings_h
......@@ -30,6 +30,7 @@
#include "ChromeClient.h"
#include "Document.h"
#include "Frame.h"
#include "GroupSettings.h"
#include "IDBFactoryBackendInterface.h"
#include "Page.h"
#include "Settings.h"
......@@ -55,6 +56,7 @@ PageGroup::PageGroup(const String& name)
: m_name(name)
, m_visitedLinksPopulated(false)
, m_identifier(getUniqueIdentifier())
, m_groupSettings(GroupSettings::create())
{
}
......@@ -200,7 +202,7 @@ StorageNamespace* PageGroup::localStorage()
// at this point we're stuck with it.
Page* page = *m_pages.begin();
const String& path = page->settings()->localStorageDatabasePath();
unsigned quota = page->settings()->localStorageQuota();
unsigned quota = m_groupSettings->localStorageQuotaBytes());
m_localStorage = StorageNamespace::localStorageNamespace(path, quota);
}
......
......@@ -36,6 +36,7 @@
namespace WebCore {
class KURL;
class GroupSettings;
class IDBFactoryBackendInterface;
class Page;
class StorageNamespace;
......@@ -94,6 +95,8 @@ namespace WebCore {
const UserScriptMap* userScripts() const { return m_userScripts.get(); }
const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); }
GroupSettings* groupSettings() const { return m_groupSettings.get(); }
private:
void addVisitedLink(LinkHash stringHash);
void resetUserStyleCacheInAllFrames();
......@@ -115,6 +118,8 @@ namespace WebCore {
OwnPtr<UserScriptMap> m_userScripts;
OwnPtr<UserStyleSheetMap> m_userStyleSheets;
OwnPtr<GroupSettings> m_groupSettings;
};
} // namespace WebCore
......
......@@ -64,10 +64,7 @@ Settings::Settings(Page* page)
, m_defaultFontSize(0)
, m_defaultFixedFontSize(0)
, m_maximumDecodedImageSize(numeric_limits<size_t>::max())
#if ENABLE(DOM_STORAGE)
, m_localStorageQuota(5 * 1024 * 1024) // Suggested by the HTML5 spec.
, m_sessionStorageQuota(StorageMap::noQuota)
#endif
, m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
, m_zoomMode(ZoomPage)
, m_isSpatialNavigationEnabled(false)
......@@ -290,17 +287,10 @@ void Settings::setLocalStorageEnabled(bool localStorageEnabled)
m_localStorageEnabled = localStorageEnabled;
}
#if ENABLE(DOM_STORAGE)
void Settings::setLocalStorageQuota(unsigned localStorageQuota)
{
m_localStorageQuota = localStorageQuota;
}
void Settings::setSessionStorageQuota(unsigned sessionStorageQuota)
{
m_sessionStorageQuota = sessionStorageQuota;
}
#endif
void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
{
......
......@@ -129,16 +129,11 @@ namespace WebCore {
void setLocalStorageEnabled(bool);
bool localStorageEnabled() const { return m_localStorageEnabled; }
#if ENABLE(DOM_STORAGE)
void setLocalStorageQuota(unsigned);
unsigned localStorageQuota() const { return m_localStorageQuota; }
// Allow clients concerned with memory consumption to set a quota on session storage
// since the memory used won't be released until the Page is destroyed.
// Default is noQuota.
void setSessionStorageQuota(unsigned);
unsigned sessionStorageQuota() const { return m_sessionStorageQuota; }
#endif
// When this option is set, WebCore will avoid storing any record of browsing activity
// that may persist on disk or remain displayed when the option is reset.
......@@ -354,10 +349,7 @@ namespace WebCore {
int m_defaultFontSize;
int m_defaultFixedFontSize;
size_t m_maximumDecodedImageSize;
#if ENABLE(DOM_STORAGE)
unsigned m_localStorageQuota;
unsigned m_sessionStorageQuota;
#endif
unsigned m_pluginAllowedRunTime;
ZoomMode m_zoomMode;
bool m_isSpatialNavigationEnabled : 1;
......
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