Diff
Modified: trunk/Source/WebKit2/ChangeLog (159981 => 159982)
--- trunk/Source/WebKit2/ChangeLog 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/ChangeLog 2013-12-03 00:43:27 UTC (rev 159982)
@@ -1,3 +1,28 @@
+2013-12-02 Sam Weinig <s...@webkit.org>
+
+ WebPageGroups should keep track of what processes they are being used by
+ https://bugs.webkit.org/show_bug.cgi?id=124556
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/WebContextUserMessageCoders.h:
+ (WebKit::WebContextUserMessageEncoder::encode):
+ (WebKit::WebContextUserMessageDecoder::decode):
+ * UIProcess/WebPageGroup.cpp:
+ (WebKit::WebPageGroup::addProcess):
+ (WebKit::WebPageGroup::disconnectProcess):
+ * UIProcess/WebPageGroup.h:
+ (WebKit::WebPageGroup::sendToAllProcessesInGroup):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::initializeWebPage):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::disconnect):
+ (WebKit::WebProcessProxy::webPageGroup):
+ (WebKit::WebProcessProxy::addWebPageGroup):
+ * UIProcess/WebProcessProxy.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::webPageGroup):
+
2013-12-02 Anders Carlsson <ander...@apple.com>
Add versioned structs for all clients except the ones in WKContext.h
Modified: trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h 2013-12-03 00:43:27 UTC (rev 159982)
@@ -76,6 +76,8 @@
}
case API::Object::Type::PageGroup: {
WebPageGroup* pageGroup = static_cast<WebPageGroup*>(m_root);
+ if (pageGroup->addProcess(m_process))
+ m_process.addWebPageGroup(*pageGroup);
encoder << pageGroup->data();
break;
}
@@ -145,7 +147,7 @@
uint64_t pageGroupID;
if (!decoder.decode(pageGroupID))
return false;
- coder.m_root = WebPageGroup::get(pageGroupID);
+ coder.m_root = coder.m_process.webPageGroup(pageGroupID);
break;
}
#if PLATFORM(MAC)
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2013-12-03 00:43:27 UTC (rev 159982)
@@ -194,4 +194,14 @@
sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserContent(), m_data.pageGroupID);
}
+bool WebPageGroup::addProcess(WebProcessProxy& process)
+{
+ return m_processes.add(&process).isNewEntry;
+}
+
+void WebPageGroup::disconnectProcess(WebProcessProxy& process)
+{
+ m_processes.remove(&process);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2013-12-03 00:43:27 UTC (rev 159982)
@@ -65,26 +65,24 @@
void removeAllUserScripts();
void removeAllUserContent();
+ bool addProcess(WebProcessProxy&);
+ void disconnectProcess(WebProcessProxy&);
+
private:
template<typename T> void sendToAllProcessesInGroup(const T&, uint64_t destinationID);
WebPageGroupData m_data;
mutable RefPtr<WebPreferences> m_preferences;
HashSet<WebPageProxy*> m_pages;
+ HashSet<WebProcessProxy*> m_processes;
};
template<typename T>
void WebPageGroup::sendToAllProcessesInGroup(const T& message, uint64_t destinationID)
{
- HashSet<WebProcessProxy*> processesSeen;
-
- for (WebPageProxy* webPageProxy : m_pages) {
- WebProcessProxy& webProcessProxy = webPageProxy->process();
- if (!processesSeen.add(&webProcessProxy).isNewEntry)
- continue;
-
- if (webProcessProxy.canSendMessage())
- webProcessProxy.send(T(message), destinationID);
+ for (auto webProcessProxy : m_processes) {
+ if (webProcessProxy->canSendMessage())
+ webProcessProxy->send(T(message), destinationID);
}
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-12-03 00:43:27 UTC (rev 159982)
@@ -514,21 +514,24 @@
ASSERT(m_drawingArea);
#if ENABLE(INSPECTOR_SERVER)
- if (m_pageGroup->preferences()->developerExtrasEnabled())
+ if (pageGroup().preferences()->developerExtrasEnabled())
inspector()->enableRemoteInspection();
#endif
+ if (pageGroup().addProcess(process()))
+ process().addWebPageGroup(pageGroup());
+
initializeCreationParameters();
- m_process->send(Messages::WebProcess::CreateWebPage(m_pageID, m_creationParameters), 0);
+ process().send(Messages::WebProcess::CreateWebPage(m_pageID, m_creationParameters), 0);
#if ENABLE(PAGE_VISIBILITY_API)
- m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
+ process().send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
#elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
- m_process->send(Messages::WebPage::SetVisibilityState(isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
+ process().send(Messages::WebPage::SetVisibilityState(isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
#endif
#if PLATFORM(MAC)
- m_process->send(Messages::WebPage::SetSmartInsertDeleteEnabled(m_isSmartInsertDeleteEnabled), m_pageID);
+ process().send(Messages::WebPage::SetSmartInsertDeleteEnabled(m_isSmartInsertDeleteEnabled), m_pageID);
#endif
}
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-12-03 00:43:27 UTC (rev 159982)
@@ -37,6 +37,7 @@
#include "WebContext.h"
#include "WebNavigationDataStore.h"
#include "WebNotificationManagerProxy.h"
+#include "WebPageGroup.h"
#include "WebPageProxy.h"
#include "WebPluginSiteDataManager.h"
#include "WebProcessMessages.h"
@@ -144,11 +145,16 @@
Vector<RefPtr<WebFrameProxy>> frames;
copyValuesToVector(m_frameMap, frames);
-
- for (size_t i = 0, size = frames.size(); i < size; ++i)
- frames[i]->disconnect();
+ for (auto frame : frames)
+ frame->disconnect();
m_frameMap.clear();
+ Vector<WebPageGroup*> pageGroups;
+ copyValuesToVector(m_pageGroups, pageGroups);
+ for (auto pageGroup : pageGroups)
+ pageGroup->disconnectProcess(*this);
+ m_pageGroups.clear();
+
if (m_downloadProxyMap)
m_downloadProxyMap->processDidClose();
@@ -209,6 +215,19 @@
return result;
}
+WebPageGroup* WebProcessProxy::webPageGroup(uint64_t pageGroupID)
+{
+ if (!HashMap<uint64_t, WebPageGroup*>::isValidKey(pageGroupID))
+ return nullptr;
+
+ return m_pageGroups.get(pageGroupID);
+}
+
+void WebProcessProxy::addWebPageGroup(WebPageGroup& pageGroup)
+{
+ m_pageGroups.add(pageGroup.pageGroupID(), &pageGroup);
+}
+
WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const
{
return m_backForwardListItemMap.get(itemID);
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (159981 => 159982)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-12-03 00:43:27 UTC (rev 159982)
@@ -82,6 +82,9 @@
void removeWebPage(uint64_t pageID);
Vector<WebPageProxy*> pages() const;
+ WebPageGroup* webPageGroup(uint64_t pageGroupID);
+ void addWebPageGroup(WebPageGroup&);
+
WebBackForwardListItem* webBackForwardItem(uint64_t itemID) const;
ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; }
@@ -194,6 +197,7 @@
WebPageProxyMap m_pageMap;
WebFrameProxyMap m_frameMap;
WebBackForwardListItemMap m_backForwardListItemMap;
+ HashMap<uint64_t, WebPageGroup*> m_pageGroups;
OwnPtr<DownloadProxyMap> m_downloadProxyMap;
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (159981 => 159982)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-12-03 00:40:33 UTC (rev 159981)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-12-03 00:43:27 UTC (rev 159982)
@@ -721,7 +721,7 @@
WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData& pageGroupData)
{
- HashMap<uint64_t, RefPtr<WebPageGroupProxy>>::AddResult result = m_pageGroupMap.add(pageGroupData.pageGroupID, nullptr);
+ auto result = m_pageGroupMap.add(pageGroupData.pageGroupID, nullptr);
if (result.isNewEntry) {
ASSERT(!result.iterator->value);
result.iterator->value = WebPageGroupProxy::create(pageGroupData);