Changeset 249419 in webkit


Ignore:
Timestamp:
Sep 3, 2019 2:57:32 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[WPE][GTK] Deprecate nonfunctional process limit APIs
https://bugs.webkit.org/show_bug.cgi?id=193749

Reviewed by Žan Doberšek.

Source/WebKit:

  • UIProcess/API/glib/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):

  • UIProcess/API/gtk/WebKitWebContext.h:
  • UIProcess/API/wpe/WebKitWebContext.h:

Tools:

  • MiniBrowser/gtk/main.c:

(main):

  • TestWebKitAPI/Tests/WebKitGLib/TestMultiprocess.cpp:

(beforeAll):
(testWebProcessLimit): Deleted.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r249379 r249419  
     12019-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [WPE][GTK] Deprecate nonfunctional process limit APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=193749
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * UIProcess/API/glib/WebKitWebContext.cpp:
     9        (webkitWebContextConstructed):
     10        (webkit_web_context_set_process_model):
     11        (webkit_web_context_get_process_model):
     12        (webkit_web_context_set_web_process_count_limit):
     13        (webkit_web_context_get_web_process_count_limit):
     14        * UIProcess/API/gtk/WebKitWebContext.h:
     15        * UIProcess/API/wpe/WebKitWebContext.h:
     16
    1172019-09-02  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp

    r249275 r249419  
    177177    WebKitTLSErrorsPolicy tlsErrorsPolicy;
    178178    WebKitProcessModel processModel;
    179     unsigned processCountLimit;
    180179
    181180    HashMap<uint64_t, WebKitWebView*> webViews;
     
    359358    priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_FAIL;
    360359    priv->processPool->setIgnoreTLSErrors(false);
     360
     361    priv->processModel = WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES;
    361362
    362363#if ENABLE(MEMORY_SAMPLER)
     
    15271528 *
    15281529 * Specifies a process model for WebViews, which WebKit will use to
    1529  * determine how auxiliary processes are handled. The default setting
    1530  * (%WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS) is suitable for most
    1531  * applications which embed a small amount of WebViews, or are used to
    1532  * display documents which are considered safe — like local files.
    1533  *
    1534  * Applications which may potentially use a large amount of WebViews
    1535  * —for example a multi-tabbed web browser— may want to use
    1536  * %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES, which will use
     1530 * determine how auxiliary processes are handled.
     1531 *
     1532 * %WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES will use
    15371533 * one process per view most of the time, while still allowing for web
    15381534 * views to share a process when needed (for example when different
     
    15421538 * normally.
    15431539 *
     1540 * %WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS is deprecated since 2.26,
     1541 * using it has no effect for security reasons.
     1542 *
    15441543 * This method **must be called before any web process has been created**,
    15451544 * as early as possible in your application. Calling it later will make
     
    15521551    g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
    15531552
     1553    if (processModel == WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS) {
     1554        g_warning("WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS is deprecated and has no effect");
     1555        return;
     1556    }
     1557
    15541558    if (processModel == context->priv->processModel)
    15551559        return;
     
    15711575WebKitProcessModel webkit_web_context_get_process_model(WebKitWebContext* context)
    15721576{
    1573     g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);
     1577    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    15741578
    15751579    return context->priv->processModel;
     
    15841588 * The default value is 0 and means no limit.
    15851589 *
    1586  * This method **must be called before any web process has been created**,
    1587  * as early as possible in your application. Calling it later will make
    1588  * your application crash.
     1590 * This function is now deprecated and does nothing for security reasons.
    15891591 *
    15901592 * Since: 2.10
     1593 *
     1594 * Deprecated: 2.26
    15911595 */
    15921596void webkit_web_context_set_web_process_count_limit(WebKitWebContext* context, guint limit)
     
    15941598    g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
    15951599
    1596     if (context->priv->processCountLimit == limit)
    1597         return;
    1598 
    1599     context->priv->processCountLimit = limit;
     1600    g_warning("webkit_web_context_set_web_process_count_limit is deprecated and does nothing. Limiting the number of web processes is no longer possible for security reasons");
    16001601}
    16011602
     
    16061607 * Gets the maximum number of web processes that can be created at the same time for the @context.
    16071608 *
     1609 * This function is now deprecated and always returns 0 (no limit). See also webkit_web_context_set_web_process_count_limit().
     1610 *
    16081611 * Returns: the maximum limit of web processes, or 0 if there isn't a limit.
    16091612 *
    16101613 * Since: 2.10
     1614 *
     1615 * Deprecated: 2.26
    16111616 */
    16121617guint webkit_web_context_get_web_process_count_limit(WebKitWebContext* context)
     
    16141619    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
    16151620
    1616     return context->priv->processCountLimit;
     1621    return 0;
    16171622}
    16181623
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebContext.h

    r243285 r249419  
    6868/**
    6969 * WebKitProcessModel:
    70  * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Use a single process to
    71  *   perform content rendering. The process is shared among all the
    72  *   #WebKitWebView instances created by the application: if the process
    73  *   hangs or crashes all the web views in the application will be affected.
    74  *   This is the default process model, and it should suffice for most cases.
     70 * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Deprecated 2.26.
    7571 * @WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES: Use one process
    7672 *   for each #WebKitWebView, while still allowing for some of them to
     
    194190webkit_web_context_get_cache_model                  (WebKitWebContext              *context);
    195191
    196 WEBKIT_API void
     192WEBKIT_DEPRECATED void
    197193webkit_web_context_set_web_process_count_limit      (WebKitWebContext              *context,
    198194                                                     guint                          limit);
    199195
    200 WEBKIT_API guint
     196WEBKIT_DEPRECATED guint
    201197webkit_web_context_get_web_process_count_limit      (WebKitWebContext              *context);
    202198
  • trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebContext.h

    r243285 r249419  
    6868/**
    6969 * WebKitProcessModel:
    70  * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Use a single process to
    71  *   perform content rendering. The process is shared among all the
    72  *   #WebKitWebView instances created by the application: if the process
    73  *   hangs or crashes all the web views in the application will be affected.
    74  *   This is the default process model, and it should suffice for most cases.
     70 * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Deprecated 2.26.
    7571 * @WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES: Use one process
    7672 *   for each #WebKitWebView, while still allowing for some of them to
     
    194190webkit_web_context_get_cache_model                  (WebKitWebContext              *context);
    195191
    196 WEBKIT_API void
     192WEBKIT_DEPRECATED void
    197193webkit_web_context_set_web_process_count_limit      (WebKitWebContext              *context,
    198194                                                     guint                          limit);
    199195
    200 WEBKIT_API guint
     196WEBKIT_DEPRECATED guint
    201197webkit_web_context_get_web_process_count_limit      (WebKitWebContext              *context);
    202198
  • trunk/Tools/ChangeLog

    r249377 r249419  
     12019-09-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [WPE][GTK] Deprecate nonfunctional process limit APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=193749
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * MiniBrowser/gtk/main.c:
     9        (main):
     10        * TestWebKitAPI/Tests/WebKitGLib/TestMultiprocess.cpp:
     11        (beforeAll):
     12        (testWebProcessLimit): Deleted.
     13
    1142019-09-02  Zan Dobersek  <zdobersek@igalia.com>
    215
  • trunk/Tools/MiniBrowser/gtk/main.c

    r249192 r249419  
    553553    }
    554554
    555     const gchar *singleprocess = g_getenv("MINIBROWSER_SINGLEPROCESS");
    556     webkit_web_context_set_process_model(webContext, (singleprocess && *singleprocess) ?
    557         WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS : WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    558 
    559555    // Enable the favicon database, by specifying the default directory.
    560556    webkit_web_context_set_favicon_database_directory(webContext, NULL);
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestMultiprocess.cpp

    r239772 r249419  
    6262        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_webViews[index].get()));
    6363
    64         m_webViewBusNames[index] = GUniquePtr<char>(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", Test::s_webExtensionID));
    65 
    6664        webkit_web_view_load_html(m_webViews[index].get(), "<html></html>", nullptr);
    6765        g_signal_connect(m_webViews[index].get(), "load-changed", G_CALLBACK(loadChanged), this);
    6866        g_main_loop_run(m_mainLoop);
     67
     68        m_webViewBusNames[index] = GUniquePtr<char>(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", Test::s_webExtensionID));
    6969    }
    7070
     
    249249}
    250250
    251 static void testWebProcessLimit(MultiprocessTest* test, gconstpointer)
    252 {
    253     g_assert_cmpuint(webkit_web_context_get_web_process_count_limit(test->m_webContext.get()), ==, 0);
    254 
    255     webkit_web_context_set_web_process_count_limit(test->m_webContext.get(), 1);
    256     g_assert_cmpuint(webkit_web_context_get_web_process_count_limit(test->m_webContext.get()), ==, 1);
    257 
    258     // Create two web views but there should be only one web process.
    259     for (unsigned i = 0; i < numViews; i++) {
    260         test->loadWebViewAndWaitUntilLoaded(i);
    261         g_assert_true(WEBKIT_IS_WEB_VIEW(test->m_webViews[i].get()));
    262     }
    263 
    264     g_assert_cmpuint(test->m_initializeWebExtensionsSignalCount, ==, 1);
    265 }
    266 
    267251void beforeAll()
    268252{
    269253    // Check that default setting is the one stated in the documentation
    270     g_assert_cmpuint(webkit_web_context_get_process_model(webkit_web_context_get_default()),
    271         ==, WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS);
    272 
    273     webkit_web_context_set_process_model(webkit_web_context_get_default(),
    274         WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    275 
    276     // Check that the getter returns the newly-set value
    277     g_assert_cmpuint(webkit_web_context_get_process_model(webkit_web_context_get_default()),
    278         ==, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
     254    g_assert_cmpuint(webkit_web_context_get_process_model(webkit_web_context_get_default()), ==, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
    279255
    280256    bus = new WebKitTestBus();
     
    284260    MultiprocessTest::add("WebKitWebContext", "process-per-web-view", testProcessPerWebView);
    285261    UIClientMultiprocessTest::add("WebKitWebView", "multiprocess-create-ready-close", testMultiprocessWebViewCreateReadyClose);
    286     MultiprocessTest::add("WebKitWebContext", "web-process-limit", testWebProcessLimit);
    287262}
    288263
Note: See TracChangeset for help on using the changeset viewer.