[BlinkGenPropertyTrees] No-op updates should not run PaintArtifactCompositor |
|
Issue descriptionWe don't want to run PaintArtifactCompositor unless it would actually do work (see rafnopac.html for an example where a no-op requestAnimationFrame currently causes PaintArtifactCompositor::Update to run). A proposal to fix this is to use a dirty bit pattern where PaintArtifactCompositor::Update early-outs if no state is dirty. PAC::Update has two purposes: 1) update cc property trees 2) update cc::Layers For tracking if cc property trees need to be updated (1), we can re-use the existing dirty bit code for whether blink needs to rebuild property trees (see the implementation of LayoutObject::SetNeedsPaintPropertyUpdate). When this is set, we can mark the frame as needing PAC::Update, similar to how LocalFrameView::SetIntersectionObservationState works. For tracking if cc::Layers need to be updated (2), we may be able to rely on existing dirty bits in cc that are set when GraphicsLayers change. LayerTreeHost::SetNeedsCommit is called when cc::Layer properties change (e.g., Layer::SetBounds) which is called when GraphicsLayers change (e.g., GraphicsLayer::SetSize). It may turn out to be cleaner to introduce a new dirty bit in blink (e.g., a bit set inside GraphicsLayer::SetSize) rather than relying on cc's. To test this we can use PaintArtifactCompositor's g_s_property_tree_sequence_number which is incremented after PaintArtifactCompositor::Update runs and set on the root cc::Layer. web_layer_list_test.cc has examples of tests that the blink->cc boundary and would be a convenient place for a simple no-op update test.
,
Jan 11
In general it is not possible to go that direction, but you can go from GraphicsLayer to LayerTreeHost (via GraphicsLayer::CcLayer()->layer_tree_host()). Cc doesn't have pointers back into blink (mostly) because cc is a generic compositor and is used by non-web things like the tab strip.
,
Jan 11
Ahh I see, that makes sense. So for the cc::Layers dirty bit, I need to query from PAC into LTH, not store a bit on PAC from LTH. Thanks!
,
Jan 11
Yep! Another approach is to add a generic interface for LTH to callback into blink. cc::Layer has did_scroll_callback calls all the way back into ScrollingCoordinator::DidScroll. This gets around the issue of cc::Layer having to include blink types. |
|
►
Sign in to add a comment |
|
Comment 1 by masonfreed@google.com
, Jan 11