Title: [192488] branches/safari-601.1.46-branch/Source/WebKit2

Diff

Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-11-16 23:05:18 UTC (rev 192488)
@@ -1,5 +1,38 @@
 2015-11-16  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r191895. rdar://problem/23501902
+
+    2015-11-02  Yongjun Zhang  <yongjun_zh...@apple.com>
+
+            Add objC delegate callback for webProcessDidBecomeResponsive and webProcessDidBecomeUnresponsive.
+            https://bugs.webkit.org/show_bug.cgi?id=150778
+
+            Add methods into WKNavigationDelegatePrivate to notify WebKit client when web process becomes unresponsive
+            or responsive, which is reported by WebKit::ResponsivenessTimer.
+
+            Reviewed by Darin Adler.
+
+            * UIProcess/API/APINavigationClient.h: Add two new method processDidBecomeResponsive and processDidBecomeUnresponsive
+                to NavigationClient; they are called when WebKit::ResponsivenessTimer update its client's state.
+            (API::NavigationClient::processDidBecomeResponsive):
+            (API::NavigationClient::processDidBecomeUnresponsive):
+            * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Add two new delegate method to WKNavigationDelegatePrivate:
+                _webViewWebProcessDidBecomeResponsive: and _webViewWebProcessDidBecomeUnresponsive:
+            * UIProcess/Cocoa/NavigationState.h: Add new overriding methods processDidBecomeResponsive and processDidBecomeUnresponsive.
+                Also add a bool member for each method to indicate if the delegate has implement the related method.
+            * UIProcess/Cocoa/NavigationState.mm:
+            (WebKit::NavigationState::setNavigationDelegate): Update the new bool members based on the delegate.
+            (WebKit::NavigationState::NavigationClient::processDidBecomeResponsive): Send the delegate message to navigationDelegate
+                if _webViewWebProcessDidBecomeResponsive: is implemented.
+            (WebKit::NavigationState::NavigationClient::processDidBecomeUnresponsive): Ditto.
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::processDidBecomeUnresponsive): Call navigationClient's processDidBecomeUnresponsive if the page proxy
+                has navigationClient.
+            (WebKit::WebPageProxy::processDidBecomeResponsive):  Call navigationClient's processDidBecomeResponsive if the page proxy
+                has navigationClient.
+
+2015-11-16  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r192138. rdar://problem/22846841
 
     2015-11-07  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/APINavigationClient.h (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/APINavigationClient.h	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/APINavigationClient.h	2015-11-16 23:05:18 UTC (rev 192488)
@@ -81,8 +81,10 @@
     virtual bool canAuthenticateAgainstProtectionSpace(WebKit::WebPageProxy&, WebKit::WebProtectionSpace*) { return false; }
     virtual void didReceiveAuthenticationChallenge(WebKit::WebPageProxy&, WebKit::AuthenticationChallengeProxy*) { }
 
-    // FIXME: This function should not be part of this client.
+    // FIXME: These function should not be part of this client.
     virtual void processDidCrash(WebKit::WebPageProxy&) { }
+    virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) { }
+    virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) { }
 
     virtual PassRefPtr<Data> webCryptoMasterKey(WebKit::WebPageProxy&) { return nullptr; }
 

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h	2015-11-16 23:05:18 UTC (rev 192488)
@@ -51,6 +51,8 @@
 - (void)_webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
 
 - (void)_webViewWebProcessDidCrash:(WKWebView *)webView;
+- (void)_webViewWebProcessDidBecomeResponsive:(WKWebView *)webView;
+- (void)_webViewWebProcessDidBecomeUnresponsive:(WKWebView *)webView;
 
 - (NSData *)_webCryptoMasterKeyForWebView:(WKWebView *)webView;
 

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2015-11-16 23:05:18 UTC (rev 192488)
@@ -97,6 +97,9 @@
         virtual bool canAuthenticateAgainstProtectionSpace(WebPageProxy&, WebProtectionSpace*) override;
         virtual void didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy*) override;
         virtual void processDidCrash(WebPageProxy&) override;
+        virtual void processDidBecomeResponsive(WebPageProxy&) override;
+        virtual void processDidBecomeUnresponsive(WebPageProxy&) override;
+
         virtual PassRefPtr<API::Data> webCryptoMasterKey(WebPageProxy&) override;
 
 #if USE(QUICK_LOOK)
@@ -167,6 +170,8 @@
         bool webViewCanAuthenticateAgainstProtectionSpace : 1;
         bool webViewDidReceiveAuthenticationChallenge : 1;
         bool webViewWebProcessDidCrash : 1;
+        bool webViewWebProcessDidBecomeResponsive : 1;
+        bool webViewWebProcessDidBecomeUnresponsive : 1;
         bool webCryptoMasterKeyForWebView : 1;
         bool webViewDidBeginNavigationGesture : 1;
         bool webViewWillEndNavigationGestureWithNavigationToBackForwardListItem : 1;

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2015-11-16 23:05:18 UTC (rev 192488)
@@ -150,6 +150,8 @@
     m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace = [delegate respondsToSelector:@selector(_webView:canAuthenticateAgainstProtectionSpace:)];
     m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
     m_navigationDelegateMethods.webViewWebProcessDidCrash = [delegate respondsToSelector:@selector(_webViewWebProcessDidCrash:)];
+    m_navigationDelegateMethods.webViewWebProcessDidBecomeResponsive = [delegate respondsToSelector:@selector(_webViewWebProcessDidBecomeResponsive:)];
+    m_navigationDelegateMethods.webViewWebProcessDidBecomeUnresponsive = [delegate respondsToSelector:@selector(_webViewWebProcessDidBecomeUnresponsive:)];
     m_navigationDelegateMethods.webCryptoMasterKeyForWebView = [delegate respondsToSelector:@selector(_webCryptoMasterKeyForWebView:)];
     m_navigationDelegateMethods.webViewDidBeginNavigationGesture = [delegate respondsToSelector:@selector(_webViewDidBeginNavigationGesture:)];
     m_navigationDelegateMethods.webViewWillEndNavigationGestureWithNavigationToBackForwardListItem = [delegate respondsToSelector:@selector(_webViewWillEndNavigationGesture:withNavigationToBackForwardListItem:)];
@@ -670,6 +672,30 @@
     [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webViewWebProcessDidCrash:m_navigationState.m_webView];
 }
 
+void NavigationState::NavigationClient::processDidBecomeResponsive(WebKit::WebPageProxy& page)
+{
+    if (!m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidBecomeResponsive)
+        return;
+
+    auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
+    if (!navigationDelegate)
+        return;
+
+    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webViewWebProcessDidBecomeResponsive:m_navigationState.m_webView];
+}
+
+void NavigationState::NavigationClient::processDidBecomeUnresponsive(WebKit::WebPageProxy& page)
+{
+    if (!m_navigationState.m_navigationDelegateMethods.webViewWebProcessDidBecomeUnresponsive)
+        return;
+
+    auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
+    if (!navigationDelegate)
+        return;
+
+    [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webViewWebProcessDidBecomeUnresponsive:m_navigationState.m_webView];
+}
+
 PassRefPtr<API::Data> NavigationState::NavigationClient::webCryptoMasterKey(WebKit::WebPageProxy&)
 {
     if (!m_navigationState.m_navigationDelegateMethods.webCryptoMasterKeyForWebView)

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (192487 => 192488)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-11-16 22:46:25 UTC (rev 192487)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-11-16 23:05:18 UTC (rev 192488)
@@ -4930,7 +4930,10 @@
 
     updateBackingStoreDiscardableState();
 
-    m_loaderClient->processDidBecomeUnresponsive(*this);
+    if (m_navigationClient)
+        m_navigationClient->processDidBecomeUnresponsive(*this);
+    else
+        m_loaderClient->processDidBecomeUnresponsive(*this);
 }
 
 void WebPageProxy::interactionOccurredWhileProcessUnresponsive()
@@ -4948,7 +4951,10 @@
     
     updateBackingStoreDiscardableState();
 
-    m_loaderClient->processDidBecomeResponsive(*this);
+    if (m_navigationClient)
+        m_navigationClient->processDidBecomeResponsive(*this);
+    else
+        m_loaderClient->processDidBecomeResponsive(*this);
 }
 
 void WebPageProxy::processDidCrash()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to