Index: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
index 5d639a1d6945e3b112569310f6e9319609b3aaf0..c02635f11bdab82bb724e2dc314f29bf8adeaad6 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp |
@@ -184,12 +184,16 @@ static LayoutVideo* FindFullscreenVideoLayoutObject(Document& document) { |
return ToLayoutVideo(layout_object); |
} |
-void PaintLayerCompositor::UpdateIfNeededRecursive() { |
+void PaintLayerCompositor::UpdateIfNeededRecursive( |
+ DocumentLifecycle::LifecycleState target_state) { |
SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Compositing.UpdateTime"); |
- UpdateIfNeededRecursiveInternal(); |
+ UpdateIfNeededRecursiveInternal(target_state); |
} |
-void PaintLayerCompositor::UpdateIfNeededRecursiveInternal() { |
+void PaintLayerCompositor::UpdateIfNeededRecursiveInternal( |
+ DocumentLifecycle::LifecycleState target_state) { |
+ DCHECK(target_state >= DocumentLifecycle::kCompositingInputsClean); |
+ |
FrameView* view = layout_view_.GetFrameView(); |
if (view->ShouldThrottleRendering()) |
return; |
@@ -205,10 +209,11 @@ void PaintLayerCompositor::UpdateIfNeededRecursiveInternal() { |
// the middle of frame detach. |
// TODO(bbudge) Remove this check when trusted Pepper plugins are gone. |
if (local_frame->GetDocument()->IsActive() && |
- !local_frame->ContentLayoutItem().IsNull()) |
+ !local_frame->ContentLayoutItem().IsNull()) { |
local_frame->ContentLayoutItem() |
.Compositor() |
- ->UpdateIfNeededRecursiveInternal(); |
+ ->UpdateIfNeededRecursiveInternal(target_state); |
+ } |
} |
TRACE_EVENT0("blink", "PaintLayerCompositor::updateIfNeededRecursive"); |
@@ -226,9 +231,11 @@ void PaintLayerCompositor::UpdateIfNeededRecursiveInternal() { |
layout_view_.CommitPendingSelection(); |
- Lifecycle().AdvanceTo(DocumentLifecycle::kInCompositingUpdate); |
- UpdateIfNeeded(); |
- Lifecycle().AdvanceTo(DocumentLifecycle::kCompositingClean); |
+ UpdateIfNeeded(target_state); |
+ DCHECK(Lifecycle().GetState() == DocumentLifecycle::kCompositingInputsClean || |
+ Lifecycle().GetState() == DocumentLifecycle::kCompositingClean); |
+ if (target_state == DocumentLifecycle::kCompositingInputsClean) |
+ return; |
Optional<CompositorElementIdSet> composited_element_ids; |
DocumentAnimations::UpdateAnimations(layout_view_.GetDocument(), |
@@ -371,20 +378,42 @@ GraphicsLayer* PaintLayerCompositor::ParentForContentLayers() const { |
return IsMainFrame() ? GetVisualViewport().ScrollLayer() : nullptr; |
} |
-void PaintLayerCompositor::UpdateIfNeeded() { |
+void PaintLayerCompositor::UpdateIfNeeded( |
+ DocumentLifecycle::LifecycleState target_state) { |
+ DCHECK(target_state >= DocumentLifecycle::kCompositingInputsClean); |
+ |
+ Lifecycle().AdvanceTo(DocumentLifecycle::kInCompositingUpdate); |
+ |
CompositingUpdateType update_type = pending_update_type_; |
pending_update_type_ = kCompositingUpdateNone; |
if (!HasAcceleratedCompositing()) { |
UpdateWithoutAcceleratedCompositing(update_type); |
+ Lifecycle().AdvanceTo( |
+ std::min(DocumentLifecycle::kCompositingClean, target_state)); |
return; |
} |
- if (update_type == kCompositingUpdateNone) |
+ if (update_type == kCompositingUpdateNone) { |
+ Lifecycle().AdvanceTo( |
+ std::min(DocumentLifecycle::kCompositingClean, target_state)); |
return; |
+ } |
PaintLayer* update_root = RootLayer(); |
+ // TODO(smcgruer): This function should be refactored, but for now just place |
+ // this here to make the target behavioral change clear. |
+ if (target_state == DocumentLifecycle::kCompositingInputsClean) { |
+ // Restore the update type. |
+ pending_update_type_ = update_type; |
+ if (pending_update_type_ >= kCompositingUpdateAfterCompositingInputChange) { |
+ CompositingInputsUpdater(update_root).Update(); |
+ } |
+ Lifecycle().AdvanceTo(DocumentLifecycle::kCompositingInputsClean); |
+ return; |
+ } |
+ |
Vector<PaintLayer*> layers_needing_paint_invalidation; |
if (update_type >= kCompositingUpdateAfterCompositingInputChange) { |
@@ -488,6 +517,8 @@ void PaintLayerCompositor::UpdateIfNeeded() { |
// Inform the inspector that the layer tree has changed. |
if (IsMainFrame()) |
probe::layerTreeDidChange(layout_view_.GetFrame()); |
+ |
+ Lifecycle().AdvanceTo(DocumentLifecycle::kCompositingClean); |
} |
static void RestartAnimationOnCompositor(const LayoutObject& layout_object) { |