Changeset 163698 in webkit


Ignore:
Timestamp:
Feb 8, 2014 12:25:22 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Adrian Perez de Castro <Adrian Perez de Castro> 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.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163696 r163698  
     12014-02-08  Adrian Perez de Castro  <aperez@igalia.com>
     2
     3        [GTK] Make process model names properly meaningful
     4        https://bugs.webkit.org/show_bug.cgi?id=128389
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        The name WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
     9        is misleading because there are situations in which web views may
     10        share the same web process even when multi-process mode is enabled;
     11        for example when opening a related view and both interact using JS.
     12
     13        * UIProcess/API/gtk/WebKitWebContext.cpp:
     14        (webkit_web_context_set_process_model):
     15        (webkit_web_context_get_process_model):
     16        Update names of WebKitProcessModel enum values.
     17        * UIProcess/API/gtk/WebKitWebContext.h:
     18        Ditto.
     19
    1202014-02-08  Piotr Grad  <p.grad@samsung.com>
    221
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r163433 r163698  
    164164static guint signals[LAST_SIGNAL] = { 0, };
    165165
    166 COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS, ProcessModelSharedSecondaryProcess);
    167 COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW, ProcessModelMultipleSecondaryProcesses);
    168 
    169166WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT)
    170167
     
    899896 * (%WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS) is suitable for most
    900897 * applications which embed a small amount of WebViews, or are used to
    901  * display documents which are considered safe -- like local files.
    902  *
    903  * Applications which may potentially use a large amount of WebViews --for
    904  * example a multi-tabbed web browser-- may want to use
    905  * %WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW to use one
    906  * process per view. Using this model, when a WebView hangs or crashes,
    907  * the rest of the WebViews in the application will still work normally.
    908  *
    909  * This method <strong>must be called before any other functions</strong>,
     898 * display documents which are considered safe — like local files.
     899 *
     900 * Applications which may potentially use a large amount of WebViews
     901 * —for example a multi-tabbed web browser— may want to use
     902 * %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES, which will use
     903 * one process per view most of the time, while still allowing for web
     904 * views to share a process when needed (for example when different
     905 * views interact with each other). Using this model, when a process
     906 * hangs or crashes, only the WebViews using it stop working, while
     907 * the rest of the WebViews in the application will still function
     908 * normally.
     909 *
     910 * This method **must be called before any other functions**,
    910911 * as early as possible in your application. Calling it later will make
    911912 * your application crash.
     
    917918    g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
    918919
    919     if (processModel != context->priv->context->processModel()) {
    920         context->priv->context->setUsesNetworkProcess(processModel == ProcessModelMultipleSecondaryProcesses);
    921         context->priv->context->setProcessModel(static_cast<ProcessModel>(processModel));
     920    ProcessModel newProcessModel;
     921
     922    switch (processModel) {
     923    case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
     924        newProcessModel = ProcessModelSharedSecondaryProcess;
     925        break;
     926    case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
     927        newProcessModel = ProcessModelMultipleSecondaryProcesses;
     928        break;
     929    default:
     930        g_assert_not_reached();
    922931    }
     932
     933    if (newProcessModel == context->priv->context->processModel())
     934        return;
     935
     936    context->priv->context->setUsesNetworkProcess(newProcessModel == ProcessModelMultipleSecondaryProcesses);
     937    context->priv->context->setProcessModel(newProcessModel);
    923938}
    924939
     
    937952{
    938953    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);
    939     return static_cast<WebKitProcessModel>(context->priv->context->processModel());
     954
     955    switch (context->priv->context->processModel()) {
     956    case ProcessModelSharedSecondaryProcess:
     957        return WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
     958    case ProcessModelMultipleSecondaryProcesses:
     959        return WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
     960    default:
     961        g_assert_not_reached();
     962    }
    940963}
    941964
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h

    r162928 r163698  
    7070 *   hangs or crashes all the web views in the application will be affected.
    7171 *   This is the default process model, and it should suffice for most cases.
    72  * @WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW: Use one process
    73  *   for each #WebKitWebView. The main advantage of this process model is that
    74  *   the rendering process for a web view can crash while the rest of the
    75  *   views keep working normally. This process model is indicated for
    76  *   applications which may use a number of web views and the content of
    77  *   in each must not interfere with the rest -- for example a full-fledged
    78  *   web browser with support for multiple tabs.
     72 * @WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES: Use one process
     73 *   for each #WebKitWebView, while still allowing for some of them to
     74 *   share a process in certain situations. The main advantage
     75 *   of this process model is that the rendering process for a web view
     76 *   can crash while the rest of the views keep working normally. This
     77 *   process model is indicated for applications which may use a number
     78 *   of web views and the content of in each must not interfere with the
     79 *   rest — for example a full-fledged web browser with support for
     80 *   multiple tabs.
    7981 *
    8082 * Enum values used for determining the #WebKitWebContext process model.
     
    8486typedef enum {
    8587    WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS,
    86     WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW,
     88    WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES,
    8789} WebKitProcessModel;
    8890
  • trunk/Tools/ChangeLog

    r163697 r163698  
     12014-02-08  Adrian Perez de Castro  <aperez@igalia.com>
     2
     3        [GTK] Make process model names properly meaningful
     4        https://bugs.webkit.org/show_bug.cgi?id=128389
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        The name WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
     9        is misleading because there are situations in which web views may
     10        share the same web process even when multi-process mode is enabled;
     11        for example when opening a related view and both interact using JS.
     12
     13        * MiniBrowser/gtk/main.c:
     14        (main):
     15        Update usage of WebKitProcessModel enum values.
     16        * TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp:
     17        (beforeAll):
     18        Ditto.
     19
    1202014-02-08  Diego Pino Garcia  <dpino@igalia.com>
    221
  • trunk/Tools/MiniBrowser/gtk/main.c

    r162928 r163698  
    245245    if (multiprocess && *multiprocess) {
    246246        webkit_web_context_set_process_model(webkit_web_context_get_default(),
    247             WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
     247            WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    248248    }
    249249
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp

    r162928 r163698  
    123123
    124124    webkit_web_context_set_process_model(webkit_web_context_get_default(),
    125         WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
     125        WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    126126
    127127    // Check that the getter returns the newly-set value
    128128    g_assert_cmpuint(webkit_web_context_get_process_model(webkit_web_context_get_default()),
    129         ==, WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW);
     129        ==, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    130130
    131131    bus = new WebKitTestBus();
Note: See TracChangeset for help on using the changeset viewer.