WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-125463-20140127162911.patch (text/plain), 22.43 KB, created by
Adrian Perez
on 2014-01-27 06:28:37 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Adrian Perez
Created:
2014-01-27 06:28:37 PST
Size:
22.43 KB
patch
obsolete
>Subversion Revision: 162835 >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 1f4f31385d6c86fda7d1f4f84ccd886fc8de31cc..d77397bdcd3363db3ed71e2202fd8476af599486 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,27 @@ >+2014-01-27 Adrian Perez de Castro <aperez@igalia.com> >+ >+ [GTK] Add API to allow setting the process model in WebKitWebContext >+ https://bugs.webkit.org/show_bug.cgi?id=125463 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implements accessors in WebKitWebContext for the process model. >+ The default behavior is unchanged, and a single web process is >+ used. Using WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW >+ as the process model will make use one web process for each >+ WebKitWebView. This also enables the network process. Setting >+ the process model must be done as early as possible, before the >+ very first web process is spawned. >+ >+ * UIProcess/API/gtk/WebKitWebContext.cpp: >+ Add accessors in the API to get/set the process model. >+ (webkit_web_context_set_process_model): >+ (webkit_web_context_get_process_model): >+ * UIProcess/API/gtk/WebKitWebContext.h: >+ Define the WebKitProcessModel enum. >+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: >+ Add new public API bits to the documentation. >+ > 2014-01-27 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Implement custom URI schemes with CustomProtocols >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >index 6509dde4fa9f05a0719ec95a9c21cf3b50a6c8f2..01358b71240c60daad4f092e2ab86d73af8f22c2 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp >@@ -64,8 +64,9 @@ using namespace WebKit; > * The #WebKitWebContext manages all aspects common to all > * #WebKitWebView<!-- -->s. > * >- * You can define the #WebKitCacheModel with >- * webkit_web_context_set_cache_model(), depending on the needs of >+ * You can define the #WebKitCacheModel and #WebKitProcessModel with >+ * webkit_web_context_set_cache_model() and >+ * webkit_web_context_set_process_model(), depending on the needs of > * your application. You can access the #WebKitCookieManager or the > * #WebKitSecurityManager to specify the behaviour of your application > * regarding cookies and security, using >@@ -161,6 +162,9 @@ 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) >@@ -228,10 +232,6 @@ static gpointer createDefaultWebContext(gpointer) > priv->context = WebContext::create(WebCore::filenameToString(injectedBundleFilename().data())); > priv->requestManager = webContext->priv->context->supplement<WebSoupCustomProtocolRequestManager>(); > priv->context->setCacheModel(CacheModelPrimaryWebBrowser); >-#if ENABLE(NETWORK_PROCESS) >- // FIXME: Temporary use an env var until we have API to set the process model. See https://bugs.webkit.org/show_bug.cgi?id=125463. >- priv->context->setUsesNetworkProcess(g_getenv("WEBKIT_USE_NETWORK_PROCESS")); >-#endif > priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_IGNORE; > > attachInjectedBundleClientToContext(webContext.get()); >@@ -888,6 +888,56 @@ void webkit_web_context_allow_tls_certificate_for_host(WebKitWebContext* context > context->priv->context->allowSpecificHTTPSCertificateForHost(webCertificateInfo.get(), String::fromUTF8(host)); > } > >+/** >+ * webkit_web_context_set_process_model: >+ * @context: the #WebKitWebContext >+ * @process_model: a #WebKitProcessModel >+ * >+ * Specifies a process model for WebViews, which WebKit will use to >+ * 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>, >+ * as early as possible in your application. Calling it later will make >+ * your application crash. >+ * >+ * Since: 2.4 >+ */ >+void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProcessModel processModel) >+{ >+ 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)); >+ } >+} >+ >+/** >+ * webkit_web_context_get_process_model: >+ * @context: the #WebKitWebContext >+ * >+ * Returns the current process model. For more information about this value >+ * see webkit_web_context_set_process_model(). >+ * >+ * Returns: the current #WebKitProcessModel >+ * >+ * Since: 2.4 >+ */ >+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()); >+} >+ > WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy) > { > GRefPtr<WebKitDownload> download = downloadsMap().get(downloadProxy); >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h >index 1e3b9b588d65a85499a86bb716cb67be23d922aa..d3e12b355046d7c8e5fb2b6da8cba7449b4bf9c4 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h >@@ -63,6 +63,30 @@ typedef enum { > } WebKitCacheModel; > > /** >+ * WebKitProcessModel: >+ * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Use a single process to >+ * perform content rendering. The process is shared among all the >+ * #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. >+ * >+ * 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, >+} WebKitProcessModel; >+ >+/** > * WebKitTLSErrorsPolicy: > * @WEBKIT_TLS_ERRORS_POLICY_IGNORE: Ignore TLS errors. > * @WEBKIT_TLS_ERRORS_POLICY_FAIL: TLS errors will emit >@@ -213,6 +237,13 @@ webkit_web_context_allow_tls_certificate_for_host (WebKitWebContext > WebKitCertificateInfo *info, > const gchar *host); > >+WEBKIT_API void >+webkit_web_context_set_process_model (WebKitWebContext *context, >+ WebKitProcessModel process_model); >+ >+WEBKIT_API WebKitProcessModel >+webkit_web_context_get_process_model (WebKitWebContext *context); >+ > G_END_DECLS > > #endif >diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >index 1c13c6c073a75d197d70562c0297921f7b6382f4..94214966d5c2656ff96c638b8498b054cd2e7cdc 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >@@ -24,6 +24,7 @@ WEBKIT_OBSOLETE_API > <TITLE>WebKitWebContext</TITLE> > WebKitWebContext > WebKitCacheModel >+WebKitProcessModel > WebKitTLSErrorsPolicy > webkit_web_context_get_default > webkit_web_context_get_cache_model >@@ -50,6 +51,8 @@ webkit_web_context_set_web_extensions_initialization_user_data > webkit_web_context_prefetch_dns > webkit_web_context_set_disk_cache_directory > webkit_web_context_allow_tls_certificate_for_host >+webkit_web_context_get_process_model >+webkit_web_context_set_process_model > > <SUBSECTION URI Scheme> > WebKitURISchemeRequestCallback >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index a4684ce97bdb1347a86a055783d4cee1629f399c..fdbc2f305dc0a21586a77029d50ff201fa30959d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,41 @@ >+2014-01-27 Adrian Perez de Castro <aperez@igalia.com> >+ >+ [GTK] Add API to allow setting the process model in WebKitWebContext >+ https://bugs.webkit.org/show_bug.cgi?id=125463 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implements accessors in WebKitWebContext for the process model. >+ The default behavior is unchanged, and a single web process is >+ used. Using WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW >+ as the process model will make use one web process for each >+ WebKitWebView. This also enables the network process. Setting >+ the process model must be done as early as possible, before the >+ very first web process is spawned. >+ >+ * MiniBrowser/gtk/main.c: >+ (main): >+ Enable multiple process mode if the MINIBROWSER_MULTIPROCESS >+ environment variable is defined and not empty. >+ * TestWebKitAPI/GNUmakefile.am: >+ Add new TestMultiprocess test case. >+ * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt: >+ Add new TestMultiprocess test case. >+ * TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp: Added. >+ (loadChanged): >+ (testMultipleSecondaryProcesses): >+ (initializeWebExtensions): >+ (beforeAll): >+ (afterAll): >+ * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp: >+ (methodCallCallback): >+ Implement the GetProcessIdentifier D-Bus method. >+ (makeBusName): >+ Choose a different bus name when the web extension is used >+ from TestMultiprocess. >+ (webkit_web_extension_initialize_with_user_data): >+ Use makeBusName() to choose the bus name. >+ > 2014-01-27 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Implement custom URI schemes with CustomProtocols >diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c >index 5049cf21f0e5d75c5bd9af4572b9109e84dd4e40..928360531c89a0dc20f3abe5e3222aae97179bbd 100644 >--- a/Tools/MiniBrowser/gtk/main.c >+++ b/Tools/MiniBrowser/gtk/main.c >@@ -241,6 +241,12 @@ int main(int argc, char *argv[]) > { > gtk_init(&argc, &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); >+ } >+ > GOptionContext *context = g_option_context_new(NULL); > g_option_context_add_main_entries(context, commandLineOptions, 0); > g_option_context_add_group(context, gtk_get_option_group(TRUE)); >diff --git a/Tools/TestWebKitAPI/GNUmakefile.am b/Tools/TestWebKitAPI/GNUmakefile.am >index 3d30c2a86d8509bea91e42659b9b8f6ed5d74494..5bf030d132347d2fe5c1cf1ea31d937b409d3419 100644 >--- a/Tools/TestWebKitAPI/GNUmakefile.am >+++ b/Tools/TestWebKitAPI/GNUmakefile.am >@@ -161,6 +161,7 @@ noinst_PROGRAMS += \ > Programs/TestWebKitAPI/WebKit2Gtk/TestInspector \ > Programs/TestWebKitAPI/WebKit2Gtk/TestInspectorServer \ > Programs/TestWebKitAPI/WebKit2Gtk/TestLoaderClient \ >+ Programs/TestWebKitAPI/WebKit2Gtk/TestMultiprocess \ > Programs/TestWebKitAPI/WebKit2Gtk/TestPrinting \ > Programs/TestWebKitAPI/WebKit2Gtk/TestResources \ > Programs/TestWebKitAPI/WebKit2Gtk/TestSSL \ >@@ -767,6 +768,12 @@ Programs_TestWebKitAPI_WebKit2Gtk_TestLoaderClient_CPPFLAGS = $(webkit2gtk_tests > Programs_TestWebKitAPI_WebKit2Gtk_TestLoaderClient_LDADD = $(webkit2gtk_tests_ldadd) > Programs_TestWebKitAPI_WebKit2Gtk_TestLoaderClient_LDFLAGS = $(webkit2gtk_tests_ldflags) > >+Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_SOURCES = \ >+ Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp >+Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_CPPFLAGS = $(webkit2gtk_tests_cppflags) >+Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_LDADD = $(webkit2gtk_tests_ldadd) >+Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_LDFLAGS = $(webkit2gtk_tests_ldflags) >+ > Programs_TestWebKitAPI_WebKit2Gtk_TestWebKitSettings_SOURCES = \ > Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp > Programs_TestWebKitAPI_WebKit2Gtk_TestWebKitSettings_CPPFLAGS = $(webkit2gtk_tests_cppflags) >diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt >index b883cf1e6d492e2d3d83e54a99e9e2b71fea0c1a..940ed733ac449375471a04bac247f7041b84f7df 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt >+++ b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt >@@ -92,6 +92,7 @@ ADD_WK2_TEST(TestFrame TestFrame.cpp) > ADD_WK2_TEST(TestInspector TestInspector.cpp) > ADD_WK2_TEST(TestInspectorServer TestInspectorServer.cpp) > ADD_WK2_TEST(TestLoaderClient TestLoaderClient.cpp) >+ADD_WK2_TEST(TestMultiprocess TestMultiprocess.cpp) > ADD_WK2_TEST(TestPrinting TestPrinting.cpp) > ADD_WK2_TEST(TestSSL TestSSL.cpp) > ADD_WK2_TEST(TestWebExtensions TestWebExtensions.cpp) >diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..242fa4b56ff14e4ceac576364c70dbe629cb446d >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp >@@ -0,0 +1,135 @@ >+/* >+ * Copyright (C) 2014 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Lesser General Public >+ * License as published by the Free Software Foundation; either >+ * version 2,1 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+ >+#include "TestMain.h" >+#include "WebKitTestBus.h" >+#include <webkit2/webkit2.h> >+#include <wtf/Vector.h> >+ >+static const unsigned numViews = 2; >+static guint32 nextInitializationId = 1; >+static unsigned initializeWebExtensionsSignalCount; >+static WebKitTestBus* bus; >+ >+class MultiprocessTest: public Test { >+public: >+ MAKE_GLIB_TEST_FIXTURE(MultiprocessTest); >+ >+ MultiprocessTest() >+ : m_mainLoop(g_main_loop_new(nullptr, TRUE)) >+ , m_webViewBusNames(numViews) >+ , m_webViews(numViews) { } >+ >+ static void loadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, MultiprocessTest* test) >+ { >+ if (loadEvent != WEBKIT_LOAD_FINISHED) >+ return; >+ g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(loadChanged), test); >+ g_main_loop_quit(test->m_mainLoop); >+ } >+ >+ void loadWebViewAndWaitUntilLoaded(unsigned index) >+ { >+ g_assert_cmpuint(index, <, numViews); >+ >+ m_webViewBusNames[index] = GUniquePtr<char>(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", nextInitializationId)); >+ >+ m_webViews[index] = WEBKIT_WEB_VIEW(webkit_web_view_new()); >+ assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_webViews[index].get())); >+ >+ webkit_web_view_load_html(m_webViews[index].get(), "<html></html>", nullptr); >+ g_signal_connect(m_webViews[index].get(), "load-changed", G_CALLBACK(loadChanged), this); >+ g_main_loop_run(m_mainLoop); >+ } >+ >+ unsigned webProcessPid(unsigned index) >+ { >+ g_assert_cmpuint(index, <, numViews); >+ >+ GRefPtr<GDBusProxy> proxy = adoptGRef(bus->createProxy(m_webViewBusNames[index].get(), >+ "/org/webkit/gtk/WebExtensionTest", "org.webkit.gtk.WebExtensionTest", m_mainLoop)); >+ >+ GRefPtr<GVariant> result = adoptGRef(g_dbus_proxy_call_sync( >+ proxy.get(), >+ "GetProcessIdentifier", >+ nullptr, >+ G_DBUS_CALL_FLAGS_NONE, >+ -1, nullptr, nullptr)); >+ g_assert(result); >+ >+ guint32 identifier = 0; >+ g_variant_get(result.get(), "(u)", &identifier); >+ return identifier; >+ } >+ >+ GMainLoop* m_mainLoop; >+ Vector<GUniquePtr<char>, numViews> m_webViewBusNames; >+ Vector<GRefPtr<WebKitWebView>, numViews> m_webViews; >+}; >+ >+static void testProcessPerWebView(MultiprocessTest* test, gconstpointer) >+{ >+ // Create two web views. As we are in multiprocess mode, there must be >+ // two web processes, running an instance of the web extension each. >+ // The initialize-web-extensions must have been called twice, and the >+ // identifiers generated for them must be different (and their reported >+ // process identifiers). >+ >+ for (unsigned i = 0; i < numViews; i++) { >+ test->loadWebViewAndWaitUntilLoaded(i); >+ g_assert(WEBKIT_IS_WEB_VIEW(test->m_webViews[i].get())); >+ g_assert(test->m_webViewBusNames[i]); >+ } >+ >+ g_assert_cmpuint(initializeWebExtensionsSignalCount, ==, numViews); >+ g_assert_cmpstr(test->m_webViewBusNames[0].get(), !=, test->m_webViewBusNames[1].get()); >+ g_assert_cmpuint(test->webProcessPid(0), !=, test->webProcessPid(1)); >+} >+ >+static void initializeWebExtensions(WebKitWebContext* context, gpointer) >+{ >+ initializeWebExtensionsSignalCount++; >+ webkit_web_context_set_web_extensions_directory(context, WEBKIT_TEST_WEB_EXTENSIONS_DIR); >+ webkit_web_context_set_web_extensions_initialization_user_data(context, >+ g_variant_new_uint32(nextInitializationId++)); >+} >+ >+void beforeAll() >+{ >+ g_signal_connect(webkit_web_context_get_default(), >+ "initialize-web-extensions", G_CALLBACK(initializeWebExtensions), nullptr); >+ >+ webkit_web_context_set_process_model(webkit_web_context_get_default(), >+ WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW); >+ >+ bus = new WebKitTestBus(); >+ if (!bus->run()) >+ return; >+ >+ MultiprocessTest::add("WebKitWebContext", "process-per-web-view", testProcessPerWebView); >+} >+ >+void afterAll() >+{ >+ delete bus; >+ g_signal_handlers_disconnect_by_func(webkit_web_context_get_default(), >+ reinterpret_cast<void*>(initializeWebExtensions), nullptr); >+} >diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp >index 2e8034f764fa405f1b63f7a3767cca6071cecbba..789430f5608d2875a2673a36f91dbdf785e50d41 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp >@@ -28,6 +28,7 @@ > #include <wtf/Deque.h> > #include <wtf/OwnPtr.h> > #include <wtf/PassOwnPtr.h> >+#include <wtf/ProcessID.h> > #include <wtf/gobject/GOwnPtr.h> > #include <wtf/gobject/GRefPtr.h> > #include <wtf/gobject/GUniquePtr.h> >@@ -49,6 +50,9 @@ static const char introspectionXML[] = > " <method name='GetInitializationUserData'>" > " <arg type='s' name='userData' direction='out'/>" > " </method>" >+ " <method name='GetProcessIdentifier'>" >+ " <arg type='u' name='identifier' direction='out'/>" >+ " </method>" > " <signal name='DocumentLoaded'/>" > " <signal name='URIChanged'>" > " <arg type='s' name='uri' direction='out'/>" >@@ -224,6 +228,9 @@ static void methodCallCallback(GDBusConnection* connection, const char* sender, > g_assert(g_variant_is_of_type(initializationUserData.get(), G_VARIANT_TYPE_STRING)); > g_dbus_method_invocation_return_value(invocation, g_variant_new("(s)", > g_variant_get_string(initializationUserData.get(), nullptr))); >+ } else if (!g_strcmp0(methodName, "GetProcessIdentifier")) { >+ g_dbus_method_invocation_return_value(invocation, >+ g_variant_new("(u)", static_cast<guint32>(getCurrentProcessID()))); > } > } > >@@ -263,6 +270,18 @@ static void busAcquiredCallback(GDBusConnection* connection, const char* name, g > } > } > >+static GUniquePtr<char> makeBusName(GVariant* userData) >+{ >+ // When the web extension is used by TestMultiprocess, an uint32 >+ // identifier is passed as user data. It uniquely identifies >+ // the web process, and the UI side expects it added as suffix to >+ // the bus name. >+ if (userData && g_variant_is_of_type(userData, G_VARIANT_TYPE_UINT32)) >+ return GUniquePtr<char>(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", g_variant_get_uint32(userData))); >+ >+ return GUniquePtr<char>(g_strdup("org.webkit.gtk.WebExtensionTest")); >+} >+ > extern "C" void webkit_web_extension_initialize_with_user_data(WebKitWebExtension* extension, GVariant* userData) > { > initializationUserData = userData; >@@ -270,9 +289,10 @@ extern "C" void webkit_web_extension_initialize_with_user_data(WebKitWebExtensio > g_signal_connect(extension, "page-created", G_CALLBACK(pageCreatedCallback), extension); > g_signal_connect(webkit_script_world_get_default(), "window-object-cleared", G_CALLBACK(windowObjectCleared), 0); > >+ GUniquePtr<char> busName(makeBusName(userData)); > g_bus_own_name( > G_BUS_TYPE_SESSION, >- "org.webkit.gtk.WebExtensionTest", >+ busName.get(), > G_BUS_NAME_OWNER_FLAGS_NONE, > busAcquiredCallback, > 0, 0,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 125463
:
218785
|
218982
|
218989
|
221792
|
221848
|
222273
|
222275
|
222323
|
222421