Chromium Code Reviews| 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 17a3e6102ef677d8f9d6c6b16425fc630682d05a..8b5e48702e9cb458a29b2935f7c33fce04e58091 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; |
| @@ -1990,6 +2006,7 @@ void LayerTreeHostImpl::ActivateSyncTree() { |
| // If we commit to the active tree directly, this is already done during |
| // commit. |
| ActivateAnimations(); |
| + Mutate(CurrentBeginFrameArgs().frame_time); |
|
ajuma
2016/05/05 14:35:45
Is this done here (rather than in the call to Anim
flackr
2016/05/05 15:13:14
Yes, comment added. However, afaik this will be th
|
| } else { |
| active_tree_->ProcessUIResourceRequestQueue(); |
| } |
| @@ -2238,10 +2255,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() { |
| @@ -3101,6 +3122,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
| UpdateRootLayerStateForSynchronousInputHandler(); |
| } |
| + // Update compositor worker mutations which may respond to scrolling. |
| + Mutate(CurrentBeginFrameArgs().frame_time); |
| + |
| return scroll_result; |
| } |
| @@ -3848,8 +3872,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( |