Changeset 162928 in webkit
- Timestamp:
- Jan 28, 2014 2:22:47 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r162920 r162928 1 2014-01-28 Adrian Perez de Castro <aperez@igalia.com> 2 3 [GTK] Add API to allow setting the process model in WebKitWebContext 4 https://bugs.webkit.org/show_bug.cgi?id=125463 5 6 Reviewed by Carlos Garcia Campos. 7 8 Implements accessors in WebKitWebContext for the process model. 9 The default behavior is unchanged, and a single web process is 10 used. Using WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW 11 as the process model will make use one web process for each 12 WebKitWebView. This also enables the network process. Setting 13 the process model must be done as early as possible, before the 14 very first web process is spawned. 15 16 * UIProcess/API/gtk/WebKitWebContext.cpp: 17 Add accessors in the API to get/set the process model. 18 (webkit_web_context_set_process_model): 19 (webkit_web_context_get_process_model): 20 * UIProcess/API/gtk/WebKitWebContext.h: 21 Define the WebKitProcessModel enum. 22 * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: 23 Add new public API bits to the documentation. 24 1 25 2014-01-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 26 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
r162920 r162928 65 65 * #WebKitWebView<!-- -->s. 66 66 * 67 * You can define the #WebKitCacheModel with 68 * webkit_web_context_set_cache_model(), depending on the needs of 67 * You can define the #WebKitCacheModel and #WebKitProcessModel with 68 * webkit_web_context_set_cache_model() and 69 * webkit_web_context_set_process_model(), depending on the needs of 69 70 * your application. You can access the #WebKitCookieManager or the 70 71 * #WebKitSecurityManager to specify the behaviour of your application … … 161 162 162 163 static guint signals[LAST_SIGNAL] = { 0, }; 164 165 COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS, ProcessModelSharedSecondaryProcess); 166 COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW, ProcessModelMultipleSecondaryProcesses); 163 167 164 168 WEBKIT_DEFINE_TYPE(WebKitWebContext, webkit_web_context, G_TYPE_OBJECT) … … 229 233 priv->requestManager = webContext->priv->context->supplement<WebSoupCustomProtocolRequestManager>(); 230 234 priv->context->setCacheModel(CacheModelPrimaryWebBrowser); 231 #if ENABLE(NETWORK_PROCESS)232 // 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.233 priv->context->setUsesNetworkProcess(g_getenv("WEBKIT_USE_NETWORK_PROCESS"));234 #endif235 235 priv->tlsErrorsPolicy = WEBKIT_TLS_ERRORS_POLICY_IGNORE; 236 236 … … 889 889 } 890 890 891 /** 892 * webkit_web_context_set_process_model: 893 * @context: the #WebKitWebContext 894 * @process_model: a #WebKitProcessModel 895 * 896 * Specifies a process model for WebViews, which WebKit will use to 897 * determine how auxiliary processes are handled. The default setting 898 * (%WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS) is suitable for most 899 * applications which embed a small amount of WebViews, or are used to 900 * display documents which are considered safe -- like local files. 901 * 902 * Applications which may potentially use a large amount of WebViews --for 903 * example a multi-tabbed web browser-- may want to use 904 * %WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW to use one 905 * process per view. Using this model, when a WebView hangs or crashes, 906 * the rest of the WebViews in the application will still work normally. 907 * 908 * This method <strong>must be called before any other functions</strong>, 909 * as early as possible in your application. Calling it later will make 910 * your application crash. 911 * 912 * Since: 2.4 913 */ 914 void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProcessModel processModel) 915 { 916 g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context)); 917 918 if (processModel != context->priv->context->processModel()) { 919 context->priv->context->setUsesNetworkProcess(processModel == ProcessModelMultipleSecondaryProcesses); 920 context->priv->context->setProcessModel(static_cast<ProcessModel>(processModel)); 921 } 922 } 923 924 /** 925 * webkit_web_context_get_process_model: 926 * @context: the #WebKitWebContext 927 * 928 * Returns the current process model. For more information about this value 929 * see webkit_web_context_set_process_model(). 930 * 931 * Returns: the current #WebKitProcessModel 932 * 933 * Since: 2.4 934 */ 935 WebKitProcessModel webkit_web_context_get_process_model(WebKitWebContext* context) 936 { 937 g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS); 938 return static_cast<WebKitProcessModel>(context->priv->context->processModel()); 939 } 940 891 941 WebKitDownload* webkitWebContextGetOrCreateDownload(DownloadProxy* downloadProxy) 892 942 { -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
r162441 r162928 64 64 65 65 /** 66 * WebKitProcessModel: 67 * @WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS: Use a single process to 68 * perform content rendering. The process is shared among all the 69 * #WebKitWebView instances created by the application: if the process 70 * hangs or crashes all the web views in the application will be affected. 71 * 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. 79 * 80 * Enum values used for determining the #WebKitWebContext process model. 81 * 82 * Since: 2.4 83 */ 84 typedef enum { 85 WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS, 86 WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW, 87 } WebKitProcessModel; 88 89 /** 66 90 * WebKitTLSErrorsPolicy: 67 91 * @WEBKIT_TLS_ERRORS_POLICY_IGNORE: Ignore TLS errors. … … 214 238 const gchar *host); 215 239 240 WEBKIT_API void 241 webkit_web_context_set_process_model (WebKitWebContext *context, 242 WebKitProcessModel process_model); 243 244 WEBKIT_API WebKitProcessModel 245 webkit_web_context_get_process_model (WebKitWebContext *context); 246 216 247 G_END_DECLS 217 248 -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
r162441 r162928 25 25 WebKitWebContext 26 26 WebKitCacheModel 27 WebKitProcessModel 27 28 WebKitTLSErrorsPolicy 28 29 webkit_web_context_get_default … … 51 52 webkit_web_context_set_disk_cache_directory 52 53 webkit_web_context_allow_tls_certificate_for_host 54 webkit_web_context_get_process_model 55 webkit_web_context_set_process_model 53 56 54 57 <SUBSECTION URI Scheme> -
trunk/Tools/ChangeLog
r162922 r162928 1 2014-01-28 Adrian Perez de Castro <aperez@igalia.com> 2 3 [GTK] Add API to allow setting the process model in WebKitWebContext 4 https://bugs.webkit.org/show_bug.cgi?id=125463 5 6 Reviewed by Carlos Garcia Campos. 7 8 Implements accessors in WebKitWebContext for the process model. 9 The default behavior is unchanged, and a single web process is 10 used. Using WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW 11 as the process model will make use one web process for each 12 WebKitWebView. This also enables the network process. Setting 13 the process model must be done as early as possible, before the 14 very first web process is spawned. 15 16 * MiniBrowser/gtk/main.c: 17 (main): 18 Enable multiple process mode if the MINIBROWSER_MULTIPROCESS 19 environment variable is defined and not empty. 20 * TestWebKitAPI/GNUmakefile.am: 21 Add new TestMultiprocess test case. 22 * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt: 23 Add new TestMultiprocess test case. 24 * TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp: Added. 25 (loadChanged): 26 (testMultipleSecondaryProcesses): 27 (initializeWebExtensions): 28 (beforeAll): 29 (afterAll): 30 * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp: 31 (methodCallCallback): 32 Implement the GetProcessIdentifier D-Bus method. 33 (makeBusName): 34 Choose a different bus name when the web extension is used 35 from TestMultiprocess. 36 (webkit_web_extension_initialize_with_user_data): 37 Use makeBusName() to choose the bus name. 38 1 39 2014-01-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 40 -
trunk/Tools/MiniBrowser/gtk/main.c
r155714 r162928 242 242 gtk_init(&argc, &argv); 243 243 244 const gchar *multiprocess = g_getenv("MINIBROWSER_MULTIPROCESS"); 245 if (multiprocess && *multiprocess) { 246 webkit_web_context_set_process_model(webkit_web_context_get_default(), 247 WEBKIT_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW); 248 } 249 244 250 GOptionContext *context = g_option_context_new(NULL); 245 251 g_option_context_add_main_entries(context, commandLineOptions, 0); -
trunk/Tools/TestWebKitAPI/GNUmakefile.am
r162922 r162928 162 162 Programs/TestWebKitAPI/WebKit2Gtk/TestInspectorServer \ 163 163 Programs/TestWebKitAPI/WebKit2Gtk/TestLoaderClient \ 164 Programs/TestWebKitAPI/WebKit2Gtk/TestMultiprocess \ 164 165 Programs/TestWebKitAPI/WebKit2Gtk/TestPrinting \ 165 166 Programs/TestWebKitAPI/WebKit2Gtk/TestResources \ … … 770 771 Programs_TestWebKitAPI_WebKit2Gtk_TestLoaderClient_LDFLAGS = $(webkit2gtk_tests_ldflags) 771 772 773 Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_SOURCES = \ 774 Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestMultiprocess.cpp 775 Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_CPPFLAGS = $(webkit2gtk_tests_cppflags) 776 Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_LDADD = $(webkit2gtk_tests_ldadd) 777 Programs_TestWebKitAPI_WebKit2Gtk_TestMultiprocess_LDFLAGS = $(webkit2gtk_tests_ldflags) 778 772 779 Programs_TestWebKitAPI_WebKit2Gtk_TestWebKitSettings_SOURCES = \ 773 780 Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt
r161366 r162928 93 93 ADD_WK2_TEST(TestInspectorServer TestInspectorServer.cpp) 94 94 ADD_WK2_TEST(TestLoaderClient TestLoaderClient.cpp) 95 ADD_WK2_TEST(TestMultiprocess TestMultiprocess.cpp) 95 96 ADD_WK2_TEST(TestPrinting TestPrinting.cpp) 96 97 ADD_WK2_TEST(TestSSL TestSSL.cpp) -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp
r162599 r162928 29 29 #include <wtf/OwnPtr.h> 30 30 #include <wtf/PassOwnPtr.h> 31 #include <wtf/ProcessID.h> 31 32 #include <wtf/gobject/GOwnPtr.h> 32 33 #include <wtf/gobject/GRefPtr.h> … … 49 50 " <method name='GetInitializationUserData'>" 50 51 " <arg type='s' name='userData' direction='out'/>" 52 " </method>" 53 " <method name='GetProcessIdentifier'>" 54 " <arg type='u' name='identifier' direction='out'/>" 51 55 " </method>" 52 56 " <signal name='DocumentLoaded'/>" … … 225 229 g_dbus_method_invocation_return_value(invocation, g_variant_new("(s)", 226 230 g_variant_get_string(initializationUserData.get(), nullptr))); 231 } else if (!g_strcmp0(methodName, "GetProcessIdentifier")) { 232 g_dbus_method_invocation_return_value(invocation, 233 g_variant_new("(u)", static_cast<guint32>(getCurrentProcessID()))); 227 234 } 228 235 } … … 264 271 } 265 272 273 static GUniquePtr<char> makeBusName(GVariant* userData) 274 { 275 // When the web extension is used by TestMultiprocess, an uint32 276 // identifier is passed as user data. It uniquely identifies 277 // the web process, and the UI side expects it added as suffix to 278 // the bus name. 279 if (userData && g_variant_is_of_type(userData, G_VARIANT_TYPE_UINT32)) 280 return GUniquePtr<char>(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", g_variant_get_uint32(userData))); 281 282 return GUniquePtr<char>(g_strdup("org.webkit.gtk.WebExtensionTest")); 283 } 284 266 285 extern "C" void webkit_web_extension_initialize_with_user_data(WebKitWebExtension* extension, GVariant* userData) 267 286 { … … 271 290 g_signal_connect(webkit_script_world_get_default(), "window-object-cleared", G_CALLBACK(windowObjectCleared), 0); 272 291 292 GUniquePtr<char> busName(makeBusName(userData)); 273 293 g_bus_own_name( 274 294 G_BUS_TYPE_SESSION, 275 "org.webkit.gtk.WebExtensionTest",295 busName.get(), 276 296 G_BUS_NAME_OWNER_FLAGS_NONE, 277 297 busAcquiredCallback,
Note: See TracChangeset
for help on using the changeset viewer.