[Qt] Enable QML handling of crashed/unresponsive QtWebProcess
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 11:06:42 +0000 (11:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 11:06:42 +0000 (11:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108474

Forward the processDidCrash, didRelaunchProcess, processDidBecomeUnresponsive
and processDidBecomeResponsive signals to QML's WebView.experimental.

Patch by Milian Wolff <milian.wolff@kdab.com> on 2013-08-01
Reviewed by Jocelyn Turcotte.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::processDidCrash):
(QQuickWebViewPrivate::didRelaunchProcess):
(QQuickWebViewPrivate::processDidBecomeUnresponsive):
(QQuickWebViewPrivate::processDidBecomeResponsive):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

index 5274fda..65f1ec8 100644 (file)
@@ -1,3 +1,22 @@
+2013-08-01  Milian Wolff  <milian.wolff@kdab.com>
+
+        [Qt] Enable QML handling of crashed/unresponsive QtWebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=108474
+
+        Forward the processDidCrash, didRelaunchProcess, processDidBecomeUnresponsive
+        and processDidBecomeResponsive signals to QML's WebView.experimental.
+
+        Reviewed by Jocelyn Turcotte.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::processDidCrash):
+        (QQuickWebViewPrivate::didRelaunchProcess):
+        (QQuickWebViewPrivate::processDidBecomeUnresponsive):
+        (QQuickWebViewPrivate::processDidBecomeResponsive):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+
 2013-07-31  Kwang Yul Seo  <skyul@company100.net>
 
         Use emptyString instead of String("")
index 1213fd9..ab30458 100644 (file)
@@ -364,6 +364,8 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
         loadClient.didChangeProgress = didChangeProgress;
         loadClient.didFinishProgress = didFinishProgress;
         loadClient.didChangeBackForwardList = didChangeBackForwardList;
+        loadClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive;
+        loadClient.processDidBecomeResponsive = processDidBecomeResponsive;
         WKPageSetPageLoaderClient(webPage.get(), &loadClient);
     }
 
@@ -598,10 +600,14 @@ void QQuickWebViewPrivate::processDidCrash()
         loadProgressDidChange(100);
         emit q->loadingChanged(&loadRequest);
     }
+
+    emit q->experimental()->processDidCrash();
 }
 
 void QQuickWebViewPrivate::didRelaunchProcess()
 {
+    Q_Q(QQuickWebView);
+
     qWarning("WARNING: The web process has been successfully restarted.");
 
     if (DrawingAreaProxy *drawingArea = webPageProxy->drawingArea()) {
@@ -611,6 +617,22 @@ void QQuickWebViewPrivate::didRelaunchProcess()
         updateUserScripts();
         updateSchemeDelegates();
     }
+
+    emit q->experimental()->didRelaunchProcess();
+}
+
+void QQuickWebViewPrivate::processDidBecomeUnresponsive(WKPageRef, const void* clientInfo)
+{
+    QQuickWebView* q = toQQuickWebViewPrivate(clientInfo)->q_ptr;
+
+    emit q->experimental()->processDidBecomeUnresponsive();
+}
+
+void QQuickWebViewPrivate::processDidBecomeResponsive(WKPageRef, const void* clientInfo)
+{
+    QQuickWebView* q = toQQuickWebViewPrivate(clientInfo)->q_ptr;
+
+    emit q->experimental()->processDidBecomeResponsive();
 }
 
 PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy()
index 468515f..86d68fc 100644 (file)
@@ -389,6 +389,11 @@ Q_SIGNALS:
     void remoteInspectorUrlChanged();
     void textFound(int matchCount);
 
+    void processDidCrash();
+    void didRelaunchProcess();
+    void processDidBecomeUnresponsive();
+    void processDidBecomeResponsive();
+
 private:
     QQuickWebViewExperimental(QQuickWebView* webView, QQuickWebViewPrivate* webViewPrivate);
     QQuickWebView* q_ptr;
index 434f411..f1ce171 100644 (file)
@@ -174,6 +174,8 @@ protected:
     static void didChangeProgress(WKPageRef, const void* clientInfo);
     static void didFinishProgress(WKPageRef, const void* clientInfo);
     static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo);
+    static void processDidBecomeUnresponsive(WKPageRef, const void* clientInfo);
+    static void processDidBecomeResponsive(WKPageRef, const void* clientInfo);
 
     QQuickWebViewPrivate(QQuickWebView* viewport);
     RefPtr<WebKit::WebPageProxy> webPageProxy;