RESOLVED FIXED Bug 150778
Add objC delegate callback for webProcessDidBecomeResponsive and webProcessDidBecomeUnresponsive.
https://bugs.webkit.org/show_bug.cgi?id=150778
Summary Add objC delegate callback for webProcessDidBecomeResponsive and webProcessDi...
Yongjun Zhang
Reported 2015-11-01 11:47:48 PST
It would be nice for a WebKit client to get notified if the web process becomes unresponsive or responsive. To that, we should consider to add delegate methods for webProcessDidBecomeResponsive and webProcessDidBecomeUnresponsive.
Attachments
Patch. (10.95 KB, patch)
2015-11-01 12:28 PST, Yongjun Zhang
no flags
Fix style issues. (10.94 KB, patch)
2015-11-01 12:36 PST, Yongjun Zhang
darin: review+
Address review comments for landing. (11.32 KB, patch)
2015-11-01 14:18 PST, Yongjun Zhang
no flags
Address review comments before landing. (9.57 KB, patch)
2015-11-01 14:20 PST, Yongjun Zhang
no flags
Yongjun Zhang
Comment 1 2015-11-01 11:48:56 PST
Yongjun Zhang
Comment 2 2015-11-01 12:28:27 PST
WebKit Commit Bot
Comment 3 2015-11-01 12:30:54 PST
Attachment 264525 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.h:104: The parameter name "page" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebKit2/UIProcess/Cocoa/NavigationState.h:105: The parameter name "page" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yongjun Zhang
Comment 4 2015-11-01 12:36:09 PST
Created attachment 264526 [details] Fix style issues.
Darin Adler
Comment 5 2015-11-01 12:43:17 PST
Comment on attachment 264526 [details] Fix style issues. View in context: https://bugs.webkit.org/attachment.cgi?id=264526&action=review > Source/WebKit2/UIProcess/API/APINavigationClient.h:87 > // FIXME: This function should not be part of this client. > virtual void processDidCrash(WebKit::WebPageProxy&) { } > + virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) { } > + virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) { } If the comment applies to all three of these, then please reword it so it says “These functions”. Why can’t WebKit2 implement the delegate by implementing the existing loader client function? Why do we have to add this to the navigation client? > Source/WebKit2/UIProcess/Cocoa/NavigationState.h:105 > + virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) override; > + virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) override; Please, no WebKit:: prefix here for the argument types for these new functions (match the function just above). > Source/WebKit2/UIProcess/Cocoa/NavigationState.h:188 > + bool webViewWebProcessDidBecomeResponsive : 1; > + bool webViewWebProcessDidBecomeUnresponsive : 1; Not sure what order these booleans are in. It’s strange to have the new ones at the bottom after the QuickLook ones. Maybe we should keep these alphabetical instead of randomly ordered? > Source/WebKit2/UIProcess/WebPageProxy.cpp:4863 > - m_loaderClient->processDidBecomeUnresponsive(*this); > + if (m_navigationClient) > + m_navigationClient->processDidBecomeUnresponsive(*this); > + else > + m_loaderClient->processDidBecomeUnresponsive(*this); Skipping the loader client function just because we have a navigation client doesn’t seem logical. Seems we should call both. > Source/WebKit2/UIProcess/WebPageProxy.cpp:4884 > - m_loaderClient->processDidBecomeResponsive(*this); > + if (m_navigationClient) > + m_navigationClient->processDidBecomeResponsive(*this); > + else > + m_loaderClient->processDidBecomeResponsive(*this); Ditto.
Yongjun Zhang
Comment 6 2015-11-01 14:09:23 PST
(In reply to comment #5) > Comment on attachment 264526 [details] > Fix style issues. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=264526&action=review > > > Source/WebKit2/UIProcess/API/APINavigationClient.h:87 > > // FIXME: This function should not be part of this client. > > virtual void processDidCrash(WebKit::WebPageProxy&) { } > > + virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) { } > > + virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) { } > > If the comment applies to all three of these, then please reword it so it > says “These functions”. I will change. > > Why can’t WebKit2 implement the delegate by implementing the existing loader > client function? Why do we have to add this to the navigation client? > Looks like WebKit2 does have loader client delegate, but it is only implemented as the deprecated WKBrowsingContextLoadDelegatePrivate, which is where browsingContextControllerWebProcessDidCrash: stays. This patch follows the way how _webViewWebProcessDidCrash and webViewWebContentProcessDidTerminate: are implemented, and they are currently staying in the negation client (WKNavigationDelegate). > > Source/WebKit2/UIProcess/Cocoa/NavigationState.h:105 > > + virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) override; > > + virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) override; > > Please, no WebKit:: prefix here for the argument types for these new > functions (match the function just above). Fixed. > > > Source/WebKit2/UIProcess/Cocoa/NavigationState.h:188 > > + bool webViewWebProcessDidBecomeResponsive : 1; > > + bool webViewWebProcessDidBecomeUnresponsive : 1; > > Not sure what order these booleans are in. It’s strange to have the new ones > at the bottom after the QuickLook ones. Maybe we should keep these > alphabetical instead of randomly ordered? Yeah, the ordering seems to random - they are not alphabetical. I will move these two bools next to webViewWebProcessDidCrash since they belong to the same category (webProcess related). > > > Source/WebKit2/UIProcess/WebPageProxy.cpp:4863 > > - m_loaderClient->processDidBecomeUnresponsive(*this); > > + if (m_navigationClient) > > + m_navigationClient->processDidBecomeUnresponsive(*this); > > + else > > + m_loaderClient->processDidBecomeUnresponsive(*this); > > Skipping the loader client function just because we have a navigation client > doesn’t seem logical. Seems we should call both. Again, this is following the pattern of WebPageProxy::processDidCrash(). I agree it is odd to skip the loader client. Will file another bug. > > > Source/WebKit2/UIProcess/WebPageProxy.cpp:4884 > > - m_loaderClient->processDidBecomeResponsive(*this); > > + if (m_navigationClient) > > + m_navigationClient->processDidBecomeResponsive(*this); > > + else > > + m_loaderClient->processDidBecomeResponsive(*this); > > Ditto.
Yongjun Zhang
Comment 7 2015-11-01 14:18:07 PST
Created attachment 264530 [details] Address review comments for landing.
Yongjun Zhang
Comment 8 2015-11-01 14:20:38 PST
Created attachment 264531 [details] Address review comments before landing.
WebKit Commit Bot
Comment 9 2015-11-02 10:27:31 PST
Comment on attachment 264531 [details] Address review comments before landing. Clearing flags on attachment: 264531 Committed r191895: <http://trac.webkit.org/changeset/191895>
WebKit Commit Bot
Comment 10 2015-11-02 10:27:35 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.