{"id":711,"date":"2014-03-24T20:26:31","date_gmt":"2014-03-24T19:26:31","guid":{"rendered":"http:\/\/blogs.igalia.com\/carlosgc\/?p=711"},"modified":"2014-03-24T20:26:31","modified_gmt":"2014-03-24T19:26:31","slug":"webkitgtk-2-4-0-the-multiprocess-made-easy","status":"publish","type":"post","link":"https:\/\/blogs.igalia.com\/carlosgc\/2014\/03\/24\/webkitgtk-2-4-0-the-multiprocess-made-easy\/","title":{"rendered":"WebKitGTK+ 2.4.0: the multiprocess made easy"},"content":{"rendered":"<p>Yes, we did it again, we have just <a href=\"https:\/\/lists.webkit.org\/pipermail\/webkit-gtk\/2014-March\/001840.html\">released WebKitGTK+ 2.4.0<\/a>, another major stable release with a lot of bug fixes, some new features and more complete API.<\/p>\n<h2>Multiple Web Processes<\/h2>\n<p>This is the most important new feature included in this release, and the one we have spent most of the release cycle with. All started during the <a href=\"https:\/\/wiki.gnome.org\/Hackfests\/WebKitGTK2013\">WebKitGTK+ hackfest<\/a> when <a href=\"http:\/\/blogs.igalia.com\/carlosgc\/2013\/12\/12\/webkitgtk-hackfest-2013-the-network-process\/\">a team of around 10 people worked together to implement the base of the multi-process support<\/a>. And at the very end of the release cycle we have been able to <a href=\"https:\/\/git.gnome.org\/browse\/epiphany\/commit\/?id=5694d817e3d831aed7474d3411d211880d6aae44\">turn it on by default in Epiphany<\/a>.<\/p>\n<h2>DOM touch events support<\/h2>\n<p><a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebView.html\">WebKitWebView<\/a> now processes the touch events happening in the widget to notify the DOM, making modern websites using DOM touch API properly work. <a href=\"http:\/\/blogs.gnome.org\/carlosg\/\">Carlos Garnacho<\/a>\u00a0has taken a screencast to show it in action<\/p>\n<p style=\"text-align: center;\"><video width=\"600\" height=\"340\" preload=\"auto\" controls=\"controls\"><source src=\"http:\/\/people.igalia.com\/cgarcia\/webkit-touch.webm\" type=\"video\/webm\" \/><\/video><\/p>\n<h2>Plugins cache<\/h2>\n<p>When the first page containing plugins was loaded, the UI process got blocked for some time, while the plugins were scanned. This was one of the <a href=\"https:\/\/bugs.webkit.org\/show_bug.cgi?id=115650\">most annoying bugs<\/a> of WebKitGTK+ introduced in 2.0. Plugins are synchronously scanned on demand during the page load, and it&#8217;s something that can&#8217;t be avoided. WebKitGTK+ 2.4 uses a persistent cache to store information about all plugins, so that plugins are only scanned the first time or when they change.<\/p>\n<h2>New API<\/h2>\n<ul>\n<li>Process model: <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#webkit-web-context-set-process-model\">webkit_web_context_set_process_model()<\/a> allows to set the <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#WebKitProcessModel\">WebKitProcessModel<\/a> used by the WebContext. The only thing you need to do to have multi web process support in your application is calling <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#webkit-web-context-set-process-model\">webkit_web_context_set_process_model()<\/a> with\u00a0<a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#WEBKIT-PROCESS-MODEL-MULTIPLE-SECONDARY-PROCESSES:CAPS\">WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES<\/a>. Applications can implement other multi web process models based on this one using <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebView.html#webkit-web-view-new-with-related-view\">webkit_web_view_new_with_related_view()<\/a> to create a web view in the same web process of another one.<\/li>\n<li>API to pass initialization data to the web extensions: We can pass initialization data using a <a href=\"https:\/\/developer.gnome.org\/glib\/stable\/glib-GVariant.html\">GVariant<\/a> from the UI process to the web extension. A new signal <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#WebKitWebContext-initialize-web-extensions\">WebKitWebContext::initialize-web-extensions<\/a> has been added to notify about the best moment to use any API that needs to be called before the web extensions are loaded. The new function <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#webkit-web-context-set-web-extensions-initialization-user-data\">webkit_web_context_set_web_extensions_initialization_user_data()<\/a> allows you to set a GVariant that will be passed to the web extension. In the web process side the new initialization function <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebExtension.html#WebKitWebExtensionInitializeWithUserDataFunction\">webkit_web_extension_initialize_with_user_data()<\/a> can be used to receive the GVariant as parameter. This way we don&#8217;t need to use <a href=\"https:\/\/git.gnome.org\/browse\/epiphany\/commit\/?id=aaf6422a17c7080f98d2d82d95ff6313ca500c0a\">ugly hacks<\/a> like the environment variables we had in Epiphany.<\/li>\n<li>TLS errors API: When the TLS errors policy set is <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#WEBKIT-TLS-ERRORS-POLICY-FAIL:CAPS\">WEBKIT_TLS_ERRORS_POLICY_FAIL<\/a> and\u00a0a website fails to load due to TLS errors, the new signal <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebView.html#WebKitWebView-load-failed-with-tls-errors\">WebKitWebView::load-failed-with-tls-errors<\/a> is emitted passing a <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitCertificateInfo.html\">WebKitCertificateInfo<\/a> to the user. The load is always finished, but now it&#8217;s possible to add an exception of the given certificate for a host with <a href=\"http:\/\/webkitgtk.org\/reference\/webkit2gtk\/stable\/WebKitWebContext.html#webkit-web-context-allow-tls-certificate-for-host\">webkit_web_context_allow_tls_certificate_for_host()<\/a>\u00a0and start a new load.<\/li>\n<\/ul>\n<p>As always a huge thanks to all the contributors that make this possible, and very specially in this release to the sponsors of the <a href=\"https:\/\/wiki.gnome.org\/Hackfests\/WebKitGTK2013\">WebKitGTK+ hackfest 2013<\/a> (<a href=\"http:\/\/www.igalia.com\/\">Igalia<\/a> and the <a href=\"http:\/\/www.gnome.org\/foundation\/\">GNOME Foundation<\/a>).<\/p>\n<h2>WebKit1 deprecation<\/h2>\n<p>There&#8217;s one last thing I would like to mention. Even when WebKit1 API has been deprecated since <a href=\"https:\/\/lists.webkit.org\/pipermail\/webkit-gtk\/2013-March\/001406.html\">we released WebKitGTK+ 2.0<\/a>, we have kept shipping both APIs in our tarball releases. <a href=\"https:\/\/lists.webkit.org\/pipermail\/webkit-gtk\/2014-March\/001821.html\">A decision hasn&#8217;t been made yet<\/a>, but this is probably the last release including the WebKit1 API, we have plans to remove the WebKit1 code from trunk and move all the build bots to run only WebKit2 tests. We encourage everybody to port their applications to WebKit2, submitting bug reports if there&#8217;s anything preventing the switch, and of course we are happy to help on IRC, mailing list, etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, we did it again, we have just released WebKitGTK+ 2.4.0, another major stable release with a lot of bug fixes, some new features and more complete API. Multiple Web Processes This is the most important new feature included in &hellip; <a href=\"https:\/\/blogs.igalia.com\/carlosgc\/2014\/03\/24\/webkitgtk-2-4-0-the-multiprocess-made-easy\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6,7,8],"tags":[22],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-free-software","category-gnome","category-igalia","category-webkit","tag-webkit"],"_links":{"self":[{"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/comments?post=711"}],"version-history":[{"count":18,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/posts\/711\/revisions\/730"}],"wp:attachment":[{"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/media?parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/categories?post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.igalia.com\/carlosgc\/wp-json\/wp\/v2\/tags?post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}