Bug 59159 - [chromium] Ensure compositing layers are up to date before entering doComposite
Summary: [chromium] Ensure compositing layers are up to date before entering doComposite
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: James Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-21 17:18 PDT by James Robinson
Modified: 2011-04-27 18:44 PDT (History)
8 users (show)

See Also:


Attachments
Patch (12.21 KB, patch)
2011-04-21 17:21 PDT, James Robinson
no flags Details | Formatted Diff | Diff
Patch (7.00 KB, patch)
2011-04-27 16:37 PDT, James Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Robinson 2011-04-21 17:18:08 PDT
[chromium] Ensure compositing layers are up to date before entering doComposite
Comment 1 James Robinson 2011-04-21 17:21:48 PDT
Created attachment 90639 [details]
Patch
Comment 2 James Robinson 2011-04-21 18:15:08 PDT
My testcase for this is extremely flaky and timing-depending, but the bad case is roughly that at the start of WebViewImpl::composite() we have a composited RenderLayer inside an iframe with a dirty z order list.  When we call paintContents() on that layer, it lazily updates the z order list and re-evaluates the compositing requirements on that RenderLayerCompositor which can change the GraphicsLayer tree.  This patch avoids the issue by explicitly updating compositing layers for every FrameView (which is 1:1 with RenderLayerCompositor) in the patch, syncing the compositing state for all FrameViews, and then not pumping the event loop until after all the paintContents() calls complete.  I've also added some assertions to make it easier to detect this case in debug builds.
Comment 3 Kenneth Russell 2011-04-26 17:10:10 PDT
Comment on attachment 90639 [details]
Patch

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

Looks good to me.

> Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:64
> +#ifndef NDEBUG
> +bool LayerRendererChromium::s_inPaintContents = false;
> +#endif

Barf!
Comment 4 James Robinson 2011-04-26 17:45:41 PDT
(In reply to comment #3)
> (From update of attachment 90639 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=90639&action=review
> 
> Looks good to me.
> 
> > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:64
> > +#ifndef NDEBUG
> > +bool LayerRendererChromium::s_inPaintContents = false;
> > +#endif
> 
> Barf!

Do you know of another way to do this?
Comment 5 Kenneth Russell 2011-04-26 18:02:11 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 90639 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=90639&action=review
> > 
> > Looks good to me.
> > 
> > > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:64
> > > +#ifndef NDEBUG
> > > +bool LayerRendererChromium::s_inPaintContents = false;
> > > +#endif
> > 
> > Barf!
> 
> Do you know of another way to do this?

Minimally I'd scope the variable inside the LayerRendererChromium instance. But if the debugger makes it difficult to examine it in that case, don't worry about it.
Comment 6 James Robinson 2011-04-26 18:04:14 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > (From update of attachment 90639 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=90639&action=review
> > > 
> > > Looks good to me.
> > > 
> > > > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:64
> > > > +#ifndef NDEBUG
> > > > +bool LayerRendererChromium::s_inPaintContents = false;
> > > > +#endif
> > > 
> > > Barf!
> > 
> > Do you know of another way to do this?
> 
> Minimally I'd scope the variable inside the LayerRendererChromium instance. But if the debugger makes it difficult to examine it in that case, don't worry about it.

LayerChromiums are constructed without a LayerRendererChromium pointer, so that doesn't trivially work.
Comment 7 James Robinson 2011-04-27 15:41:41 PDT
Committed r85112: <http://trac.webkit.org/changeset/85112>
Comment 8 WebKit Review Bot 2011-04-27 15:59:55 PDT
http://trac.webkit.org/changeset/85112 might have broken Leopard Intel Debug (Build) and SnowLeopard Intel Release (Build)
Comment 9 James Robinson 2011-04-27 16:01:59 PDT
Reverted r85112 for reason:

Broke mac compile

Committed r85116: <http://trac.webkit.org/changeset/85116>
Comment 10 James Robinson 2011-04-27 16:09:39 PDT
FrameView.h is included from files in the WebKit project on Mac, so adding a header to FrameView.h requires adding that header to the forwarding headers.

Given that CompositingUpdateAfterLayoutOrStyleChange and CompositingUpdateOnPaintingOrHitTest in practice do exactly the same thing I think I'll just not add the parameter to FrameView::updateCompositingLayers()
Comment 11 James Robinson 2011-04-27 16:37:33 PDT
Created attachment 91377 [details]
Patch
Comment 12 James Robinson 2011-04-27 16:37:49 PDT
Take two - this patch only modifies chromium-specific code.
Comment 13 WebKit Review Bot 2011-04-27 16:54:12 PDT
http://trac.webkit.org/changeset/85116 might have broken SnowLeopard Intel Release (Tests)
Comment 14 Kenneth Russell 2011-04-27 18:32:24 PDT
Comment on attachment 91377 [details]
Patch

Looks fine to me.
Comment 15 James Robinson 2011-04-27 18:44:01 PDT
Comment on attachment 91377 [details]
Patch

Clearing flags on attachment: 91377

Committed r85136: <http://trac.webkit.org/changeset/85136>
Comment 16 James Robinson 2011-04-27 18:44:05 PDT
All reviewed patches have been landed.  Closing bug.