Bug 141907 - [WK2][Mac] WebPageProxy::supressVisibilityUpdates() should suppress visibility updates.
Summary: [WK2][Mac] WebPageProxy::supressVisibilityUpdates() should suppress visibilit...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-23 08:23 PST by Jer Noble
Modified: 2015-03-02 09:39 PST (History)
2 users (show)

See Also:


Attachments
Patch (3.62 KB, patch)
2015-02-23 08:31 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (3.70 KB, patch)
2015-02-23 12:52 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (3.74 KB, patch)
2015-02-25 13:54 PST, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2015-02-23 08:23:41 PST
[WK2][Mac] WebPageProxy::supressVisibilityUpdates() should suppress visibility updates.
Comment 1 Jer Noble 2015-02-23 08:31:00 PST
Created attachment 247118 [details]
Patch
Comment 2 Jer Noble 2015-02-23 12:52:52 PST
Created attachment 247136 [details]
Patch
Comment 3 Tim Horton 2015-02-23 13:04:40 PST
Comment on attachment 247136 [details]
Patch

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

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1231
> +        m_viewStateChangeDispatcher->schedule();

If one of the suppressed changes was a view-in-window change or any of the requests requested immediate dispatch, you should probably do that here instead of waiting for the next runloop.

> Source/WebKit2/UIProcess/WebPageProxy.cpp:1262
> +    if (m_suppressVisibilityUpdates)

It is super dangerous for any viewStateDidChange call that wantsSynchronousReply or immediate dispatch to bail like this, because often the caller will be blocking waiting for a reply that won't come.

You should add an assert or logging or something here. Or something? It's just scary and has caused lots of trouble in the past.
Comment 4 Jer Noble 2015-02-25 13:40:54 PST
(In reply to comment #3)
> Comment on attachment 247136 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=247136&action=review
> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:1231
> > +        m_viewStateChangeDispatcher->schedule();
> 
> If one of the suppressed changes was a view-in-window change or any of the
> requests requested immediate dispatch, you should probably do that here
> instead of waiting for the next runloop.

Well, the immediate dispatch thing should never happen if we add an ASSERT, as you suggest below.  But why should we do the view-in-window change immediately? It's already been delayed; what's wrong with delaying a bit longer?

> > Source/WebKit2/UIProcess/WebPageProxy.cpp:1262
> > +    if (m_suppressVisibilityUpdates)
> 
> It is super dangerous for any viewStateDidChange call that
> wantsSynchronousReply or immediate dispatch to bail like this, because often
> the caller will be blocking waiting for a reply that won't come.
> 
> You should add an assert or logging or something here. Or something? It's
> just scary and has caused lots of trouble in the past.

Ok, lets add an ASSERT. From looking at all the call points, this should never get hit, but better safe than sorry.
Comment 5 Jer Noble 2015-02-25 13:49:55 PST
(In reply to comment #4)
> (In reply to comment #3)
> > Comment on attachment 247136 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=247136&action=review
> > 
> > > Source/WebKit2/UIProcess/WebPageProxy.cpp:1231
> > > +        m_viewStateChangeDispatcher->schedule();
> > 
> > If one of the suppressed changes was a view-in-window change or any of the
> > requests requested immediate dispatch, you should probably do that here
> > instead of waiting for the next runloop.
> 
> Well, the immediate dispatch thing should never happen if we add an ASSERT,
> as you suggest below.  But why should we do the view-in-window change
> immediately? It's already been delayed; what's wrong with delaying a bit
> longer?
> 
> > > Source/WebKit2/UIProcess/WebPageProxy.cpp:1262
> > > +    if (m_suppressVisibilityUpdates)
> > 
> > It is super dangerous for any viewStateDidChange call that
> > wantsSynchronousReply or immediate dispatch to bail like this, because often
> > the caller will be blocking waiting for a reply that won't come.
> > 
> > You should add an assert or logging or something here. Or something? It's
> > just scary and has caused lots of trouble in the past.
> 
> Ok, lets add an ASSERT. From looking at all the call points, this should
> never get hit, but better safe than sorry.

Actually, looking at all the call sites, I think it would be safe here to just ignore the m_suppressVisibilityUpdates flag if immediate dispatch is requested.
Comment 6 Jer Noble 2015-02-25 13:54:11 PST
Created attachment 247343 [details]
Patch
Comment 7 WebKit Commit Bot 2015-03-02 09:39:31 PST
Comment on attachment 247343 [details]
Patch

Clearing flags on attachment: 247343

Committed r180886: <http://trac.webkit.org/changeset/180886>
Comment 8 WebKit Commit Bot 2015-03-02 09:39:35 PST
All reviewed patches have been landed.  Closing bug.