Diff
Modified: trunk/Source/WebKit/ChangeLog (226018 => 226019)
--- trunk/Source/WebKit/ChangeLog 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/ChangeLog 2017-12-18 08:55:12 UTC (rev 226019)
@@ -1,5 +1,26 @@
2017-12-18 Carlos Garcia Campos <cgar...@igalia.com>
+ [GTK][WPE] Add WebKitWebView::web-process-terminated signal and deprecate web-process-crashed
+ https://bugs.webkit.org/show_bug.cgi?id=180862
+
+ Reviewed by Michael Catanzaro.
+
+ Once the memory pressure web process monitor is enabled in bug #180861 the web process can be killed due to
+ memory limits. We need to expose the reason of the web process termination to allow applications handle the
+ memory limit case.
+
+ * UIProcess/API/glib/WebKitNavigationClient.cpp:
+ * UIProcess/API/glib/WebKitWebView.cpp:
+ (webkit_web_view_class_init):
+ (webkitWebViewWebProcessTerminated):
+ (webkitWebViewWebProcessCrashed): Deleted.
+ * UIProcess/API/glib/WebKitWebViewPrivate.h:
+ * UIProcess/API/gtk/WebKitWebView.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+ * UIProcess/API/wpe/WebKitWebView.h:
+
+2017-12-18 Carlos Garcia Campos <cgar...@igalia.com>
+
[GTK][WPE] Enable WebProcess memory monitor
https://bugs.webkit.org/show_bug.cgi?id=180861
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp 2017-12-18 08:55:12 UTC (rev 226019)
@@ -107,9 +107,17 @@
void processDidTerminate(WebPageProxy&, ProcessTerminationReason reason) override
{
- if (reason == ProcessTerminationReason::RequestedByClient)
- return;
- webkitWebViewWebProcessCrashed(m_webView);
+ switch (reason) {
+ case ProcessTerminationReason::Crash:
+ webkitWebViewWebProcessTerminated(m_webView, WEBKIT_WEB_PROCESS_CRASHED);
+ break;
+ case ProcessTerminationReason::ExceededMemoryLimit:
+ webkitWebViewWebProcessTerminated(m_webView, WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT);
+ break;
+ case ProcessTerminationReason::ExceededCPULimit:
+ case ProcessTerminationReason::RequestedByClient:
+ break;
+ }
}
void decidePolicyForNavigationAction(WebPageProxy&, Ref<API::NavigationAction>&& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* /* userData */) override
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2017-12-18 08:55:12 UTC (rev 226019)
@@ -145,6 +145,7 @@
INSECURE_CONTENT_DETECTED,
WEB_PROCESS_CRASHED,
+ WEB_PROCESS_TERMINATED,
AUTHENTICATE,
@@ -1806,6 +1807,8 @@
*
* Returns: %TRUE to stop other handlers from being invoked for the event.
* %FALSE to propagate the event further.
+ *
+ * Deprecated: 2.20: Use WebKitWebView::web-process-terminated instead.
*/
signals[WEB_PROCESS_CRASHED] = g_signal_new(
"web-process-crashed",
@@ -1817,6 +1820,26 @@
G_TYPE_BOOLEAN, 0);
/**
+ * WebKitWebView::web-process-terminated:
+ * @web_view: the #WebKitWebView
+ * @reason: the a #WebKitWebProcessTerminationReason
+ *
+ * This signal is emitted when the web process terminates abnormally due
+ * to @reason.
+ *
+ * Since: 2.20
+ */
+ signals[WEB_PROCESS_TERMINATED] = g_signal_new(
+ "web-process-terminated",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitWebViewClass, web_process_terminated),
+ 0, 0,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_WEB_PROCESS_TERMINATION_REASON);
+
+ /**
* WebKitWebView::authenticate:
* @web_view: the #WebKitWebView on which the signal is emitted
* @request: a #WebKitAuthenticationRequest
@@ -3818,10 +3841,13 @@
}
#endif
-void webkitWebViewWebProcessCrashed(WebKitWebView* webView)
+void webkitWebViewWebProcessTerminated(WebKitWebView* webView, WebKitWebProcessTerminationReason reason)
{
- gboolean returnValue;
- g_signal_emit(webView, signals[WEB_PROCESS_CRASHED], 0, &returnValue);
+ if (reason == WEBKIT_WEB_PROCESS_CRASHED) {
+ gboolean returnValue;
+ g_signal_emit(webView, signals[WEB_PROCESS_CRASHED], 0, &returnValue);
+ }
+ g_signal_emit(webView, signals[WEB_PROCESS_TERMINATED], 0, reason);
}
#if PLATFORM(GTK)
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h 2017-12-18 08:55:12 UTC (rev 226019)
@@ -81,7 +81,7 @@
void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*);
void webkitWebViewInsecureContentDetected(WebKitWebView*, WebKitInsecureContentEvent);
bool webkitWebViewEmitShowNotification(WebKitWebView*, WebKitNotification*);
-void webkitWebViewWebProcessCrashed(WebKitWebView*);
+void webkitWebViewWebProcessTerminated(WebKitWebView*, WebKitWebProcessTerminationReason);
void webkitWebViewIsPlayingAudioChanged(WebKitWebView*);
void webkitWebViewSelectionDidChange(WebKitWebView*);
void webkitWebViewRequestInstallMissingMediaPlugins(WebKitWebView*, WebKit::InstallMissingMediaPluginsPermissionRequest&);
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebView.h (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebView.h 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebView.h 2017-12-18 08:55:12 UTC (rev 226019)
@@ -186,6 +186,20 @@
WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
} WebKitSnapshotRegion;
+/**
+ * WebKitWebProcessTerminationReason:
+ * @WEBKIT_WEB_PROCESS_CRASHED: the web process crashed.
+ * @WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: the web process exceeded the memory limit.
+ *
+ * Enum values used to specify the reason why the web process terminated abnormally.
+ *
+ * Since: 2.20
+ */
+typedef enum {
+ WEBKIT_WEB_PROCESS_CRASHED,
+ WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT
+} WebKitWebProcessTerminationReason;
+
struct _WebKitWebView {
WebKitWebViewBase parent;
@@ -253,10 +267,11 @@
gboolean (* show_option_menu) (WebKitWebView *web_view,
GdkRectangle *rectangle,
WebKitOptionMenu *menu);
+ void (* web_process_terminated) (WebKitWebView *web_view,
+ WebKitWebProcessTerminationReason reason);
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
- void (*_webkit_reserved2) (void);
};
WEBKIT_API GType
Modified: trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt 2017-12-18 08:55:12 UTC (rev 226019)
@@ -145,6 +145,7 @@
WebKitInsecureContentEvent
WebKitSnapshotOptions
WebKitSnapshotRegion
+WebKitWebProcessTerminationReason
<SUBSECTION Editing Commands>
WEBKIT_EDITING_COMMAND_CUT
Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h (226018 => 226019)
--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebView.h 2017-12-18 08:55:12 UTC (rev 226019)
@@ -153,6 +153,20 @@
WEBKIT_INSECURE_CONTENT_DISPLAYED
} WebKitInsecureContentEvent;
+/**
+ * WebKitWebProcessTerminationReason:
+ * @WEBKIT_WEB_PROCESS_CRASHED: the web process crashed.
+ * @WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: the web process exceeded the memory limit.
+ *
+ * Enum values used to specify the reason why the web process terminated abnormally.
+ *
+ * Since: 2.20
+ */
+typedef enum {
+ WEBKIT_WEB_PROCESS_CRASHED,
+ WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT
+} WebKitWebProcessTerminationReason;
+
struct _WebKitWebView {
GObject parent;
@@ -213,6 +227,8 @@
GTlsCertificateFlags errors);
gboolean (* show_notification) (WebKitWebView *web_view,
WebKitNotification *notification);
+ void (* web_process_terminated) (WebKitWebView *web_view,
+ WebKitWebProcessTerminationReason reason);
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
@@ -222,7 +238,6 @@
void (*_webkit_reserved5) (void);
void (*_webkit_reserved6) (void);
void (*_webkit_reserved7) (void);
- void (*_webkit_reserved8) (void);
};
WEBKIT_API GType
Modified: trunk/Tools/ChangeLog (226018 => 226019)
--- trunk/Tools/ChangeLog 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Tools/ChangeLog 2017-12-18 08:55:12 UTC (rev 226019)
@@ -1,3 +1,24 @@
+2017-12-18 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK][WPE] Add WebKitWebView::web-process-terminated signal and deprecate web-process-crashed
+ https://bugs.webkit.org/show_bug.cgi?id=180862
+
+ Reviewed by Michael Catanzaro.
+
+ Use WebKitWebView::web-process-terminated instead of web-process-crashed in tests. I'm not adding a test for
+ WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT because we would need to allocate more than 1GB in the test and wait
+ 30 seconds, and we don't want to do either in unit tests.
+
+ * TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
+ (webProcessTerminatedCallback):
+ (testWebKitWebViewProcessCrashed):
+ (webProcessCrashedCallback): Deleted.
+ * TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp:
+ (WebViewTest::initializeWebView):
+ (WebViewTest::webProcessTerminated):
+ (WebViewTest::webProcessCrashed): Deleted.
+ * TestWebKitAPI/glib/WebKitGLib/WebViewTest.h:
+
2017-12-17 Mark Lam <mark....@apple.com>
Enhance Ref and RefPtr to be able to work with smart pointers.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp (226018 => 226019)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp 2017-12-18 08:55:12 UTC (rev 226019)
@@ -81,8 +81,9 @@
g_dbus_connection_signal_unsubscribe(connection, id);
}
-static gboolean webProcessCrashedCallback(WebKitWebView*, WebViewTest* test)
+static gboolean webProcessTerminatedCallback(WebKitWebView*, WebKitWebProcessTerminationReason reason, WebViewTest* test)
{
+ g_assert_cmpuint(reason, ==, WEBKIT_WEB_PROCESS_CRASHED);
test->quitMainLoop();
return FALSE;
@@ -93,8 +94,8 @@
test->loadHtml("<html></html>", 0);
test->waitUntilLoadFinished();
- g_signal_connect_after(test->m_webView, "web-process-crashed",
- G_CALLBACK(webProcessCrashedCallback), test);
+ g_signal_connect_after(test->m_webView, "web-process-terminated",
+ G_CALLBACK(webProcessTerminatedCallback), test);
test->m_expectedWebProcessCrash = true;
Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp (226018 => 226019)
--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.cpp 2017-12-18 08:55:12 UTC (rev 226019)
@@ -58,10 +58,10 @@
platformInitializeWebView();
assertObjectIsDeletedWhenTestFinishes(G_OBJECT(m_webView));
- g_signal_connect(m_webView, "web-process-crashed", G_CALLBACK(WebViewTest::webProcessCrashed), this);
+ g_signal_connect(m_webView, "web-process-terminated", G_CALLBACK(WebViewTest::webProcessTerminated), this);
}
-gboolean WebViewTest::webProcessCrashed(WebKitWebView*, WebViewTest* test)
+gboolean WebViewTest::webProcessTerminated(WebKitWebView*, WebKitWebProcessTerminationReason, WebViewTest* test)
{
if (test->m_expectedWebProcessCrash) {
test->m_expectedWebProcessCrash = false;
Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h (226018 => 226019)
--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h 2017-12-18 08:25:08 UTC (rev 226018)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebViewTest.h 2017-12-18 08:55:12 UTC (rev 226019)
@@ -90,7 +90,7 @@
// in our constructor, before a derived class's vtable is ready.
void initializeWebExtensions() final { Test::initializeWebExtensions(); }
- static gboolean webProcessCrashed(WebKitWebView*, WebViewTest*);
+ static gboolean webProcessTerminated(WebKitWebView*, WebKitWebProcessTerminationReason, WebViewTest*);
GRefPtr<WebKitUserContentManager> m_userContentManager;
WebKitWebView* m_webView { nullptr };