Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 3d134464edae5174c63c823f59a117e31be51dbf..fc2cb5e4cc23d3b1e743ff06a68cd4662b18f8e1 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -226,6 +226,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
shared_bitmap_manager_(shared_bitmap_manager), |
gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
task_graph_runner_(task_graph_runner), |
+ mutator_(nullptr), |
id_(id), |
requires_high_res_to_draw_(false), |
is_likely_to_require_a_draw_(false), |
@@ -459,6 +460,8 @@ void LayerTreeHostImpl::AnimateInternal(bool active_tree) { |
did_animate |= AnimateTopControls(monotonic_time); |
if (active_tree) { |
+ did_animate |= Mutate(monotonic_time); |
+ |
// Animating stuff can change the root scroll offset, so inform the |
// synchronous input handler. |
UpdateRootLayerStateForSynchronousInputHandler(); |
@@ -470,6 +473,20 @@ void LayerTreeHostImpl::AnimateInternal(bool active_tree) { |
} |
} |
+bool LayerTreeHostImpl::Mutate(base::TimeTicks monotonic_time) { |
+ if (!mutator_) |
+ return false; |
+ TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::Mutate"); |
+ if (mutator_->Mutate(monotonic_time, active_tree_.get())) |
+ client_->SetNeedsOneBeginImplFrameOnImplThread(); |
+ return true; |
+} |
+ |
+void LayerTreeHostImpl::SetNeedsMutate() { |
+ TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::SetNeedsMutate"); |
+ client_->SetNeedsOneBeginImplFrameOnImplThread(); |
+} |
+ |
bool LayerTreeHostImpl::PrepareTiles() { |
if (!tile_priorities_dirty_) |
return false; |
@@ -2060,6 +2077,7 @@ void LayerTreeHostImpl::ActivateSyncTree() { |
// If we commit to the active tree directly, this is already done during |
// commit. |
ActivateAnimations(); |
+ Mutate(CurrentBeginFrameArgs().frame_time); |
} else { |
active_tree_->ProcessUIResourceRequestQueue(); |
} |
@@ -2310,6 +2328,14 @@ void LayerTreeHostImpl::PostFrameTimingEvents( |
std::move(main_frame_events)); |
} |
+void LayerTreeHostImpl::SetLayerTreeMutator(LayerTreeMutator* mutator) { |
+ if (mutator == mutator_) |
+ return; |
+ TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::SetLayerTreeMutator"); |
+ mutator_ = mutator; |
+ mutator_->SetClient(this); |
+} |
+ |
void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { |
ClearUIResources(); |
tile_manager_->FinishTasksAndCleanUp(); |
@@ -2981,6 +3007,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
UpdateRootLayerStateForSynchronousInputHandler(); |
} |
+ // Update compositor worker mutations which may respond to scrolling. |
+ Mutate(CurrentBeginFrameArgs().frame_time); |
+ |
return scroll_result; |
} |