Skip to content
Permalink
Browse files
[GTK] Use the network process unconditionally
https://bugs.webkit.org/show_bug.cgi?id=151541

Reviewed by Alex Christensen.

Source/WebKit2:

Make the shared secondary process model become multiple secondary
process model with a limit of 1 web process. Use the same options
when creating a context with legacy configuration (unit tests and
inspector proxy).

* NetworkProcess/gtk/NetworkProcessMainGtk.cpp:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_set_process_model):
(webkit_web_context_get_process_model):
(webkit_web_context_set_web_process_count_limit):
(webkit_web_context_get_web_process_count_limit):
(toWebKitProcessModel): Deleted.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::setIgnoreTLSErrors):
(WebKit::WebProcessPool::platformInitializeWebProcess):

Tools:

Fix TestInspectorServer test. Do not assume we already have the
title we want when the page has been loaded, since the title is
changed afterwards. So, check if the title has already been set,
and if not wait for it.

* TestWebKitAPI/Tests/WebKit2Gtk/TestInspectorServer.cpp:
(openRemoteDebuggingSession):

Canonical link: https://commits.webkit.org/169722@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Nov 24, 2015
1 parent 32e436b commit 7f4c0dd5c1bfd8c0a8cdc2a48240f5194e8de9aa
@@ -1,3 +1,30 @@
2015-11-23 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Use the network process unconditionally
https://bugs.webkit.org/show_bug.cgi?id=151541

Reviewed by Alex Christensen.

Make the shared secondary process model become multiple secondary
process model with a limit of 1 web process. Use the same options
when creating a context with legacy configuration (unit tests and
inspector proxy).

* NetworkProcess/gtk/NetworkProcessMainGtk.cpp:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_set_process_model):
(webkit_web_context_get_process_model):
(webkit_web_context_set_web_process_count_limit):
(webkit_web_context_get_web_process_count_limit):
(toWebKitProcessModel): Deleted.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::setIgnoreTLSErrors):
(WebKit::WebProcessPool::platformInitializeWebProcess):

2015-11-23 Brian Burg <bburg@apple.com>

Web Inspector: inspector settings should not be shared between different inspection levels
@@ -43,16 +43,6 @@ class NetworkProcessMain final: public ChildProcessMainBase {
SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile);
return true;
}

void platformFinalize() override
{
#if !ENABLE(NETWORK_CACHE)
if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) {
soup_cache_flush(soupCache);
soup_cache_dump(soupCache);
}
#endif
}
};

int NetworkProcessMainUnix(int argc, char** argv)
@@ -41,8 +41,16 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions(
auto configuration = ProcessPoolConfiguration::create();

configuration->m_shouldHaveLegacyDataStore = true;
#if PLATFORM(GTK)
// FIXME: Remove this ifdef once all ports have switched to use always NetworkProcess.
// See https://bugs.webkit.org/show_bug.cgi?id=151418.
configuration->m_processModel = WebKit::ProcessModelMultipleSecondaryProcesses;
configuration->m_maximumProcessCount = 1;
configuration->m_useNetworkProcess = true;
#else
configuration->m_processModel = WebKit::ProcessModelSharedSecondaryProcess;
configuration->m_useNetworkProcess = false;
#endif
configuration->m_cacheModel = WebKit::CacheModelDocumentViewer;

configuration->m_applicationCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory();
@@ -179,6 +179,8 @@ struct _WebKitWebContextPrivate {

CString faviconDatabaseDirectory;
WebKitTLSErrorsPolicy tlsErrorsPolicy;
WebKitProcessModel processModel;
unsigned processCountLimit;

HashMap<uint64_t, WebKitWebView*> webViews;

@@ -193,32 +195,6 @@ static guint signals[LAST_SIGNAL] = { 0, };

WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)

static inline WebKit::ProcessModel toProcessModel(WebKitProcessModel webKitProcessModel)
{
switch (webKitProcessModel) {
case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
return ProcessModelSharedSecondaryProcess;
case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
return ProcessModelMultipleSecondaryProcesses;
default:
ASSERT_NOT_REACHED();
return ProcessModelSharedSecondaryProcess;
}
}

static inline WebKitProcessModel toWebKitProcessModel(WebKit::ProcessModel processModel)
{
switch (processModel) {
case ProcessModelSharedSecondaryProcess:
return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
case ProcessModelMultipleSecondaryProcesses:
return WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
default:
ASSERT_NOT_REACHED();
return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
}
}

static const char* injectedBundleDirectory()
{
#if ENABLE(DEVELOPER_MODE)
@@ -285,8 +261,7 @@ static void webkitWebContextConstructed(GObject* object)

API::ProcessPoolConfiguration configuration;
configuration.setInjectedBundlePath(WebCore::filenameToString(bundleFilename.get()));
configuration.setProcessModel(ProcessModelSharedSecondaryProcess);
configuration.setUseNetworkProcess(false);
configuration.setMaximumProcessCount(1);

WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
WebKitWebContextPrivate* priv = webContext->priv;
@@ -1169,13 +1144,18 @@ void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProce
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));

ProcessModel newProcessModel(toProcessModel(processModel));

if (newProcessModel == context->priv->context->processModel())
if (processModel == context->priv->processModel)
return;

context->priv->context->setUsesNetworkProcess(newProcessModel == ProcessModelMultipleSecondaryProcesses);
context->priv->context->setProcessModel(newProcessModel);
context->priv->processModel = processModel;
switch (context->priv->processModel) {
case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
context->priv->context->setMaximumNumberOfProcesses(1);
break;
case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
context->priv->context->setMaximumNumberOfProcesses(context->priv->processCountLimit);
break;
}
}

/**
@@ -1193,7 +1173,7 @@ WebKitProcessModel webkit_web_context_get_process_model(WebKitWebContext* contex
{
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);

return toWebKitProcessModel(context->priv->context->processModel());
return context->priv->processModel;
}

/**
@@ -1214,10 +1194,12 @@ void webkit_web_context_set_web_process_count_limit(WebKitWebContext* context, g
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));

if (limit == context->priv->context->configuration().maximumProcessCount())
if (context->priv->processCountLimit == limit)
return;

context->priv->context->setMaximumNumberOfProcesses(limit);
context->priv->processCountLimit = limit;
if (context->priv->processModel != WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS)
context->priv->context->setMaximumNumberOfProcesses(limit);
}

/**
@@ -1234,7 +1216,7 @@ guint webkit_web_context_get_web_process_count_limit(WebKitWebContext* context)
{
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);

return context->priv->context->configuration().maximumProcessCount();
return context->priv->processCountLimit;
}

WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy)
@@ -31,6 +31,7 @@

#include "WebKitWebViewBasePrivate.h"
#include "WebPageGroup.h"
#include "WebProcessPool.h"
#include "WebProcessProxy.h"
#include <WebCore/FileSystem.h>
#include <WebCore/GtkUtilities.h>
@@ -95,16 +95,6 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
parameters.urlSchemesRegisteredAsLocal.append("resource");
}

if (!usesNetworkProcess()) {
parameters.urlSchemesRegisteredForCustomProtocols = supplement<WebSoupCustomProtocolRequestManager>()->registeredSchemesForCustomProtocols();

supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;

parameters.ignoreTLSErrors = m_ignoreTLSErrors;
parameters.diskCacheDirectory = m_configuration->diskCacheDirectory();
}

parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;
}

@@ -146,11 +136,8 @@ String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
{
m_ignoreTLSErrors = ignoreTLSErrors;
if (usesNetworkProcess() && networkProcess()) {
if (networkProcess())
networkProcess()->send(Messages::NetworkProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors), 0);
return;
}
sendToAllProcesses(Messages::WebProcess::SetIgnoreTLSErrors(m_ignoreTLSErrors));
}

} // namespace WebKit
@@ -1,3 +1,18 @@
2015-11-23 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Use the network process unconditionally
https://bugs.webkit.org/show_bug.cgi?id=151541

Reviewed by Alex Christensen.

Fix TestInspectorServer test. Do not assume we already have the
title we want when the page has been loaded, since the title is
changed afterwards. So, check if the title has already been set,
and if not wait for it.

* TestWebKitAPI/Tests/WebKit2Gtk/TestInspectorServer.cpp:
(openRemoteDebuggingSession):

2015-11-23 Alex Christensen <achristensen@webkit.org>

Fix crash in ~WebProcessPool when using Geolocation with useNetworkProcess=true
@@ -237,12 +237,10 @@ static void openRemoteDebuggingSession(InspectorServerTest* test, gconstpointer)
test->loadURI(resolvedURL.utf8().data());
test->waitUntilLoadFinished();

javascriptResult = test->runJavaScriptAndWaitUntilFinished("document.title", &error.outPtr());
g_assert(javascriptResult);
g_assert(!error.get());

GUniquePtr<char> title(WebViewTest::javascriptResultToCString(javascriptResult));
g_assert_cmpstr(title.get(), ==, "127.0.0.1");
const char* title = webkit_web_view_get_title(test->m_webView);
if (!title || !*title)
test->waitUntilTitleChanged();
g_assert_cmpstr(webkit_web_view_get_title(test->m_webView), ==, "127.0.0.1");
}

static void sendIncompleteRequest(InspectorServerTest* test, gconstpointer)

0 comments on commit 7f4c0dd

Please sign in to comment.