Title: [163644] trunk/Source/WebKit2
- Revision
- 163644
- Author
- ander...@apple.com
- Date
- 2014-02-07 13:42:30 -0800 (Fri, 07 Feb 2014)
Log Message
Simplify WebPreferences creation inside WebPageGroup
https://bugs.webkit.org/show_bug.cgi?id=128392
Reviewed by Andreas Kling.
Always create a WebPreferences object when creating the web page group.
This is another step towards letting WebPageProxy manage web preferences.
* UIProcess/WebPageGroup.cpp:
(WebKit::pageGroupData):
(WebKit::WebPageGroup::WebPageGroup):
(WebKit::WebPageGroup::~WebPageGroup):
(WebKit::WebPageGroup::setPreferences):
(WebKit::WebPageGroup::preferences):
* UIProcess/WebPageGroup.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (163643 => 163644)
--- trunk/Source/WebKit2/ChangeLog 2014-02-07 21:39:16 UTC (rev 163643)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-07 21:42:30 UTC (rev 163644)
@@ -1,3 +1,21 @@
+2014-02-07 Anders Carlsson <ander...@apple.com>
+
+ Simplify WebPreferences creation inside WebPageGroup
+ https://bugs.webkit.org/show_bug.cgi?id=128392
+
+ Reviewed by Andreas Kling.
+
+ Always create a WebPreferences object when creating the web page group.
+ This is another step towards letting WebPageProxy manage web preferences.
+
+ * UIProcess/WebPageGroup.cpp:
+ (WebKit::pageGroupData):
+ (WebKit::WebPageGroup::WebPageGroup):
+ (WebKit::WebPageGroup::~WebPageGroup):
+ (WebKit::WebPageGroup::setPreferences):
+ (WebKit::WebPageGroup::preferences):
+ * UIProcess/WebPageGroup.h:
+
2014-02-07 Gavin Barraclough <barraclo...@apple.com>
Reenable AppNap
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (163643 => 163644)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2014-02-07 21:39:16 UTC (rev 163643)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2014-02-07 21:42:30 UTC (rev 163644)
@@ -65,25 +65,34 @@
return webPageGroupMap().get(pageGroupID);
}
-WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
+static WebPageGroupData pageGroupData(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
{
- m_data.pageGroupID = generatePageGroupID();
+ WebPageGroupData data;
+ data.pageGroupID = generatePageGroupID();
+
if (!identifier.isEmpty())
- m_data.identifer = identifier;
+ data.identifer = identifier;
else
- m_data.identifer = m_data.identifer = makeString("__uniquePageGroupID-", String::number(m_data.pageGroupID));
+ data.identifer = makeString("__uniquePageGroupID-", String::number(data.pageGroupID));
- m_data.visibleToInjectedBundle = visibleToInjectedBundle;
- m_data.visibleToHistoryClient = visibleToHistoryClient;
-
+ data.visibleToInjectedBundle = visibleToInjectedBundle;
+ data.visibleToHistoryClient = visibleToHistoryClient;
+
+ return data;
+}
+
+WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
+ : m_data(pageGroupData(identifier, visibleToInjectedBundle, visibleToHistoryClient))
+ , m_preferences(WebPreferences::create(m_data.identifer))
+{
+ m_preferences->addPageGroup(this);
webPageGroupMap().set(m_data.pageGroupID, this);
}
WebPageGroup::~WebPageGroup()
{
- if (m_preferences)
- m_preferences->removePageGroup(this);
+ m_preferences->removePageGroup(this);
webPageGroupMap().remove(pageGroupID());
}
@@ -102,34 +111,18 @@
if (preferences == m_preferences)
return;
- if (!m_preferences) {
- m_preferences = preferences;
- m_preferences->addPageGroup(this);
+ m_preferences->removePageGroup(this);
+ m_preferences = preferences;
+ m_preferences->addPageGroup(this);
- for (auto& webPageProxy : m_pages)
- webPageProxy->setPreferences(*m_preferences);
- } else {
- m_preferences->removePageGroup(this);
- m_preferences = preferences;
- m_preferences->addPageGroup(this);
+ for (auto& webPageProxy : m_pages)
+ webPageProxy->setPreferences(*m_preferences);
- for (auto& webPageProxy : m_pages)
- webPageProxy->setPreferences(*m_preferences);
-
- preferencesDidChange();
- }
+ preferencesDidChange();
}
WebPreferences& WebPageGroup::preferences() const
{
- if (!m_preferences) {
- if (!m_data.identifer.isNull())
- m_preferences = WebPreferences::create(m_data.identifer);
- else
- m_preferences = WebPreferences::create();
- m_preferences->addPageGroup(const_cast<WebPageGroup*>(this));
- }
-
return *m_preferences;
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (163643 => 163644)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2014-02-07 21:39:16 UTC (rev 163643)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2014-02-07 21:42:30 UTC (rev 163644)
@@ -69,7 +69,7 @@
template<typename T> void sendToAllProcessesInGroup(const T&, uint64_t destinationID);
WebPageGroupData m_data;
- mutable RefPtr<WebPreferences> m_preferences;
+ RefPtr<WebPreferences> m_preferences;
HashSet<WebPageProxy*> m_pages;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes