| 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 97852176f80da1697da3ce3e18ad66f2df08d3a9..f1ff6a0e87ef77981caeac2a83e5c40f1bac571c 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -462,6 +462,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();
|
| @@ -473,6 +475,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))
|
| + client_->SetNeedsOneBeginImplFrameOnImplThread();
|
| + return true;
|
| +}
|
| +
|
| +void LayerTreeHostImpl::SetNeedsMutate() {
|
| + TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::SetNeedsMutate");
|
| + client_->SetNeedsOneBeginImplFrameOnImplThread();
|
| +}
|
| +
|
| bool LayerTreeHostImpl::PrepareTiles() {
|
| if (!tile_priorities_dirty_)
|
| return false;
|
| @@ -2000,6 +2016,10 @@ void LayerTreeHostImpl::ActivateSyncTree() {
|
| // If we commit to the active tree directly, this is already done during
|
| // commit.
|
| ActivateAnimations();
|
| +
|
| + // Compositor worker operates on the active tree so we have to run again
|
| + // after activation.
|
| + Mutate(CurrentBeginFrameArgs().frame_time);
|
| } else {
|
| active_tree_->ProcessUIResourceRequestQueue();
|
| }
|
| @@ -2248,10 +2268,14 @@ void LayerTreeHostImpl::CreateResourceAndRasterBufferProvider(
|
| settings_.renderer_settings.preferred_tile_format);
|
| }
|
|
|
| -void LayerTreeHostImpl::SetLayerTreeMutator(LayerTreeMutator* mutator) {
|
| +void LayerTreeHostImpl::SetLayerTreeMutator(
|
| + std::unique_ptr<LayerTreeMutator> mutator) {
|
| + if (mutator == mutator_)
|
| + return;
|
| TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
|
| "LayerTreeHostImpl::SetLayerTreeMutator");
|
| - mutator_ = mutator;
|
| + mutator_ = std::move(mutator);
|
| + mutator_->SetClient(this);
|
| }
|
|
|
| void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
|
| @@ -3111,6 +3135,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
|
| UpdateRootLayerStateForSynchronousInputHandler();
|
| }
|
|
|
| + // Update compositor worker mutations which may respond to scrolling.
|
| + Mutate(CurrentBeginFrameArgs().frame_time);
|
| +
|
| return scroll_result;
|
| }
|
|
|
| @@ -3858,8 +3885,11 @@ void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
|
| return;
|
|
|
| LayerImpl* layer = tree->LayerById(layer_id);
|
| - if (layer)
|
| + if (layer) {
|
| layer->OnScrollOffsetAnimated(scroll_offset);
|
| + // Run mutation callbacks to respond to updated scroll offset.
|
| + Mutate(CurrentBeginFrameArgs().frame_time);
|
| + }
|
| }
|
|
|
| void LayerTreeHostImpl::TreeLayerTransformIsPotentiallyAnimatingChanged(
|
|
|