Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Web Inspector: Give nested inspectors their own process pool
https://bugs.webkit.org/show_bug.cgi?id=153880
<rdar://problem/24508310>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-02-04
Reviewed by Timothy Hatcher.

When inspecting the inspector both inspectors were using the same
Inspector process and sharing the same VM. This meant that profiling
information was confusing (memory and JavaScript sampling) because
it was showing data about both inspectors sharing the same process.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::inspectorProcessPool):
(WebKit::WebInspectorProxy::isInspectorProcessPool):
Have two process pools. The main inspector process pool (1st level inspectors)
and a nested inspector process pool (inspecting the inspector, only expected
by WebKit developers).

* UIProcess/WebInspectorProxy.h:
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
Pass the inspectionLevel to determine the appropriate pool to use.

Canonical link: https://commits.webkit.org/171984@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JosephPecoraro authored and webkit-commit-queue committed Feb 4, 2016
1 parent 45a67bd commit f3c55b9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
29 changes: 29 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,32 @@
2016-02-04 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: Give nested inspectors their own process pool
https://bugs.webkit.org/show_bug.cgi?id=153880
<rdar://problem/24508310>

Reviewed by Timothy Hatcher.

When inspecting the inspector both inspectors were using the same
Inspector process and sharing the same VM. This meant that profiling
information was confusing (memory and JavaScript sampling) because
it was showing data about both inspectors sharing the same process.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::inspectorProcessPool):
(WebKit::WebInspectorProxy::isInspectorProcessPool):
Have two process pools. The main inspector process pool (1st level inspectors)
and a nested inspector process pool (inspecting the inspector, only expected
by WebKit developers).

* UIProcess/WebInspectorProxy.h:
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
Pass the inspectionLevel to determine the appropriate pool to use.

2016-02-04 Csaba Osztrogonác <ossy@webkit.org>

Fix the !ENABLE(NETSCAPE_PLUGIN_API) build after r196053
Expand Down
21 changes: 10 additions & 11 deletions Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Expand Up @@ -304,26 +304,25 @@ void WebInspectorProxy::togglePageProfiling()
m_isProfilingPage = !m_isProfilingPage;
}

static WebProcessPool* s_processPool;
static WebProcessPool* s_mainInspectorProcessPool;
static WebProcessPool* s_nestedInspectorProcessPool;

WebProcessPool& WebInspectorProxy::inspectorProcessPool()
WebProcessPool& WebInspectorProxy::inspectorProcessPool(unsigned inspectionLevel)
{
// Having our own process pool removes us from the main process pool and
// guarantees no process sharing for our user interface.
if (!s_processPool) {
WebProcessPool*& pool = inspectionLevel == 1 ? s_mainInspectorProcessPool : s_nestedInspectorProcessPool;
if (!pool) {
auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions();
s_processPool = &WebProcessPool::create(configuration.get()).leakRef();
};

return *s_processPool;
pool = &WebProcessPool::create(configuration.get()).leakRef();
}
return *pool;
}

bool WebInspectorProxy::isInspectorProcessPool(WebProcessPool& processPool)
{
if (!s_processPool)
return false;

return s_processPool == &processPool;
return (s_mainInspectorProcessPool && s_mainInspectorProcessPool == &processPool)
|| (s_nestedInspectorProcessPool && s_nestedInspectorProcessPool == &processPool);
}

bool WebInspectorProxy::isInspectorPage(WebPageProxy& webPage)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/WebInspectorProxy.h
Expand Up @@ -153,7 +153,7 @@ class WebInspectorProxy : public API::ObjectImpl<API::Object::Type::Inspector>,
private:
explicit WebInspectorProxy(WebPageProxy*);

static WebProcessPool& inspectorProcessPool();
static WebProcessPool& inspectorProcessPool(unsigned inspectionLevel);

void eagerlyCreateInspectorPage();

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
Expand Up @@ -106,7 +106,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
if (!m_inspectorWindow)
return 0;

WKContextRef wkContext = toAPI(&inspectorProcessPool());
WKContextRef wkContext = toAPI(&inspectorProcessPool(inspectionLevel()));
WKRetainPtr<WKStringRef> wkGroupIdentifier = adoptWK(WKStringCreateWithUTF8CString(inspectorPageGroupIdentifier().utf8().data()));
WKPageGroupRef wkPageGroup = WKPageGroupCreateWithIdentifier(wkGroupIdentifier.get());

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Expand Up @@ -80,7 +80,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(inspectorPageGroupIdentifier(), false, false);

auto pageConfiguration = API::PageConfiguration::create();
pageConfiguration->setProcessPool(&inspectorProcessPool());
pageConfiguration->setProcessPool(&inspectorProcessPool(inspectionLevel()));
pageConfiguration->setPreferences(preferences.get());
pageConfiguration->setPageGroup(pageGroup.get());
m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(*pageConfiguration.ptr()));
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
Expand Up @@ -375,7 +375,7 @@ static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParameters
preferences._pageVisibilityBasedProcessSuppressionEnabled = NO;
}

[configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool())];
[configuration setProcessPool: ::WebKit::wrapper(inspectorProcessPool(inspectionLevel()))];
[configuration _setGroupIdentifier:inspectorPageGroupIdentifier()];

m_inspectorView = adoptNS([[WKWebInspectorWKWebView alloc] initWithFrame:initialRect configuration:configuration.get()]);
Expand Down

0 comments on commit f3c55b9

Please sign in to comment.