Bug 153037 - WebKit2 should have an API for eagerly querying whether the web process is responsive
Summary: WebKit2 should have an API for eagerly querying whether the web process is re...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-12 13:18 PST by Geoffrey Garen
Modified: 2016-01-13 14:45 PST (History)
5 users (show)

See Also:


Attachments
Patch (9.16 KB, patch)
2016-01-12 13:28 PST, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (9.21 KB, patch)
2016-01-12 14:38 PST, Geoffrey Garen
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2016-01-12 13:18:49 PST
WebKit2 should have an API for eagerly querying whether the web process is responsive
Comment 1 Geoffrey Garen 2016-01-12 13:28:25 PST
Created attachment 268805 [details]
Patch
Comment 2 WebKit Commit Bot 2016-01-12 13:30:19 PST
Attachment 268805 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:2643:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:746:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Anders Carlsson 2016-01-12 13:43:09 PST
Comment on attachment 268805 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268805&action=review

> Source/WebKit2/UIProcess/WebPageProxy.cpp:2647
> +        callbackFunction(webProcessIsResponsive);

You don't want to call this directly from the callback; it needs to be asynchronous. Please use RunLoop::main().dispatch.

> Source/WebKit2/UIProcess/WebProcessProxy.cpp:558
> +    Vector<std::function<void(bool webProcessIsResponsive)>> isResponsiveCallbacks = WTFMove(m_isResponsiveCallbacks);

auto isResponsiveCallbacks?

> Source/WebKit2/UIProcess/WebProcessProxy.cpp:1004
> +            bool webProcessIsResponsive = false;
> +            callback(webProcessIsResponsive);

Same callback about being asynchronous here.

> Source/WebKit2/UIProcess/WebProcessProxy.h:258
> +    bool m_isResponsive;

m_isResponsive doesn't reflect the member variable fully. Here's my understanding:

m_isResponsive = false -> We know that the web process is unresponsive.
m_isResponsive = true -> We think that the web process is responsive.

Maybe rename it to m_isKnownToBeUnresponsive and then invert the checks?
Comment 4 Geoffrey Garen 2016-01-12 14:38:42 PST
Created attachment 268813 [details]
Patch
Comment 5 WebKit Commit Bot 2016-01-12 14:39:29 PST
Attachment 268813 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:2643:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:746:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Geoffrey Garen 2016-01-12 14:39:52 PST
> https://bugs.webkit.org/attachment.cgi?id=268805&action=review
> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:2647
> > +        callbackFunction(webProcessIsResponsive);
> 
> You don't want to call this directly from the callback; it needs to be
> asynchronous. Please use RunLoop::main().dispatch.

Fixed.

> 
> > Source/WebKit2/UIProcess/WebProcessProxy.cpp:558
> > +    Vector<std::function<void(bool webProcessIsResponsive)>> isResponsiveCallbacks = WTFMove(m_isResponsiveCallbacks);
> 
> auto isResponsiveCallbacks?

Fixed.

> 
> > Source/WebKit2/UIProcess/WebProcessProxy.cpp:1004
> > +            bool webProcessIsResponsive = false;
> > +            callback(webProcessIsResponsive);
> 
> Same callback about being asynchronous here.

Fixed.

> > Source/WebKit2/UIProcess/WebProcessProxy.h:258
> > +    bool m_isResponsive;
> 
> m_isResponsive doesn't reflect the member variable fully. Here's my
> understanding:
> 
> m_isResponsive = false -> We know that the web process is unresponsive.
> m_isResponsive = true -> We think that the web process is responsive.
> 
> Maybe rename it to m_isKnownToBeUnresponsive and then invert the checks?

I made this an enum.

I renamed the API to remove "get" from the name since Tim and Alex seemed not to like "get".
Comment 7 Geoffrey Garen 2016-01-12 14:49:59 PST
(Anders didn't like "get" either.)
Comment 8 Geoffrey Garen 2016-01-13 14:45:51 PST
Committed r194986: <http://trac.webkit.org/changeset/194986>