Skip to content

Commit

Permalink
Merge r163698 - [GTK] Make process model names properly meaningful
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=128389

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2014-02-08
Reviewed by Carlos Garcia Campos.

The name WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
is misleading because there are situations in which web views may
share the same web process even when multi-process mode is enabled;
for example when opening a related view and both interact using JS.

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_set_process_model):
(webkit_web_context_get_process_model):
Update names of WebKitProcessModel enum values.
* UIProcess/API/gtk/WebKitWebContext.h:
Ditto.

Tools:

* MiniBrowser/gtk/main.c:
(main):
Update usage of WebKitProcessModel enum values.
* TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
(beforeAll):
Ditto.
  • Loading branch information
aperezdc authored and carlosgcampos committed Feb 10, 2014
1 parent c3da979 commit 772b462
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 27 deletions.
19 changes: 19 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,22 @@
2014-02-08 Adrian Perez de Castro <aperez@igalia.com>

[GTK] Make process model names properly meaningful
https://bugs.webkit.org/show_bug.cgi?id=128389

Reviewed by Carlos Garcia Campos.

The name WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
is misleading because there are situations in which web views may
share the same web process even when multi-process mode is enabled;
for example when opening a related view and both interact using JS.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_set_process_model):
(webkit_web_context_get_process_model):
Update names of WebKitProcessModel enum values.
* UIProcess/API/gtk/WebKitWebContext.h:
Ditto.

2014-02-09 Carlos Garnacho <carlosg@gnome.org>

[GTK] Implement support touch events
Expand Down
55 changes: 39 additions & 16 deletions Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
Expand Up @@ -162,9 +162,6 @@ struct _WebKitWebContextPrivate {

static guint signals[LAST_SIGNAL] = { 0, };

COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS, ProcessModelSharedSecondaryProcess);
COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW, ProcessModelMultipleSecondaryProcesses);

WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)

static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass)
Expand Down Expand Up @@ -897,15 +894,19 @@ void webkit_web_context_allow_tls_certificate_for_host(WebKitWebContext* context
* determine how auxiliary processes are handled. The default setting
* (%WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS) is suitable for most
* applications which embed a small amount of WebViews, or are used to
* display documents which are considered safe -- like local files.
*
* Applications which may potentially use a large amount of WebViews --for
* example a multi-tabbed web browser-- may want to use
* %WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW to use one
* process per view. Using this model, when a WebView hangs or crashes,
* the rest of the WebViews in the application will still work normally.
*
* This method <strong>must be called before any other functions</strong>,
* display documents which are considered safe — like local files.
*
* Applications which may potentially use a large amount of WebViews
* —for example a multi-tabbed web browser— may want to use
* %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES, which will use
* one process per view most of the time, while still allowing for web
* views to share a process when needed (for example when different
* views interact with each other). Using this model, when a process
* hangs or crashes, only the WebViews using it stop working, while
* the rest of the WebViews in the application will still function
* normally.
*
* This method **must be called before any other functions**,
* as early as possible in your application. Calling it later will make
* your application crash.
*
Expand All @@ -915,10 +916,24 @@ void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProce
{
g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));

if (processModel != context->priv->context->processModel()) {
context->priv->context->setUsesNetworkProcess(processModel == ProcessModelMultipleSecondaryProcesses);
context->priv->context->setProcessModel(static_cast<ProcessModel>(processModel));
ProcessModel newProcessModel;

switch (processModel) {
case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
newProcessModel = ProcessModelSharedSecondaryProcess;
break;
case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
newProcessModel = ProcessModelMultipleSecondaryProcesses;
break;
default:
g_assert_not_reached();
}

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

context->priv->context->setUsesNetworkProcess(newProcessModel == ProcessModelMultipleSecondaryProcesses);
context->priv->context->setProcessModel(newProcessModel);
}

/**
Expand All @@ -935,7 +950,15 @@ void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProce
WebKitProcessModel webkit_web_context_get_process_model(WebKitWebContext* context)
{
g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);
return static_cast<WebKitProcessModel>(context->priv->context->processModel());

switch (context->priv->context->processModel()) {
case ProcessModelSharedSecondaryProcess:
return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
case ProcessModelMultipleSecondaryProcesses:
return WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
default:
g_assert_not_reached();
}
}

WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy)
Expand Down
18 changes: 10 additions & 8 deletions Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
Expand Up @@ -69,21 +69,23 @@ typedef enum {
* #WebKitWebView instances created by the application: if the process
* hangs or crashes all the web views in the application will be affected.
* This is the default process model, and it should suffice for most cases.
* @WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW: Use one process
* for each #WebKitWebView. The main advantage of this process model is that
* the rendering process for a web view can crash while the rest of the
* views keep working normally. This process model is indicated for
* applications which may use a number of web views and the content of
* in each must not interfere with the rest -- for example a full-fledged
* web browser with support for multiple tabs.
* @WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES: Use one process
* for each #WebKitWebView, while still allowing for some of them to
* share a process in certain situations. The main advantage
* of this process model is that the rendering process for a web view
* can crash while the rest of the views keep working normally. This
* process model is indicated for applications which may use a number
* of web views and the content of in each must not interfere with the
* rest — for example a full-fledged web browser with support for
* multiple tabs.
*
* Enum values used for determining the #WebKitWebContext process model.
*
* Since: 2.4
*/
typedef enum {
WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS,
WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW,
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES,
} WebKitProcessModel;

/**
Expand Down
19 changes: 19 additions & 0 deletions Tools/ChangeLog
@@ -1,3 +1,22 @@
2014-02-08 Adrian Perez de Castro <aperez@igalia.com>

[GTK] Make process model names properly meaningful
https://bugs.webkit.org/show_bug.cgi?id=128389

Reviewed by Carlos Garcia Campos.

The name WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
is misleading because there are situations in which web views may
share the same web process even when multi-process mode is enabled;
for example when opening a related view and both interact using JS.

* MiniBrowser/gtk/main.c:
(main):
Update usage of WebKitProcessModel enum values.
* TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
(beforeAll):
Ditto.

2014-02-09 Carlos Garnacho <carlosg@gnome.org>

[GTK] Enable touch features
Expand Down
2 changes: 1 addition & 1 deletion Tools/MiniBrowser/gtk/main.c
Expand Up @@ -244,7 +244,7 @@ int main(int argc, char *argv[])
const gchar *multiprocess = g_getenv("MINIBROWSER_MULTIPROCESS");
if (multiprocess && *multiprocess) {
webkit_web_context_set_process_model(webkit_web_context_get_default(),
WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
}

GOptionContext *context = g_option_context_new(NULL);
Expand Down
4 changes: 2 additions & 2 deletions Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp
Expand Up @@ -122,11 +122,11 @@ void beforeAll()
==, WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);

webkit_web_context_set_process_model(webkit_web_context_get_default(),
WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);

// Check that the getter returns the newly-set value
g_assert_cmpuint(webkit_web_context_get_process_model(webkit_web_context_get_default()),
==, WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
==, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);

bus = new WebKitTestBus();
if (!bus->run())
Expand Down

0 comments on commit 772b462

Please sign in to comment.