| 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 203670f6be57d8cc0298194af7410bda4f468cc3..2e21bed1f621a802e4370332c8f2e5b702eff8db 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -224,7 +224,9 @@ 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),
|
| + is_scrolling_(false),
|
| requires_high_res_to_draw_(false),
|
| is_likely_to_require_a_draw_(false),
|
| frame_timing_tracker_(FrameTimingTracker::Create(this)) {
|
| @@ -326,7 +328,7 @@ void LayerTreeHostImpl::BeginCommit() {
|
| }
|
|
|
| void LayerTreeHostImpl::CommitComplete() {
|
| - TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
|
| + TRACE_EVENT0("cc,compositor-worker", "LayerTreeHostImpl::CommitComplete");
|
|
|
| if (CommitToActiveTree()) {
|
| // We have to activate animations here or "IsActive()" is true on the layers
|
| @@ -457,6 +459,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();
|
| @@ -468,6 +472,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;
|
| @@ -2038,6 +2056,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();
|
| }
|
| @@ -2287,6 +2306,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();
|
| @@ -2737,6 +2764,7 @@ gfx::Vector2dF LayerTreeHostImpl::ScrollLayer(LayerImpl* layer_impl,
|
| // screen (such as wheel events) represent a fixed amount of scrolling so we
|
| // can just apply them directly, but the page scale factor is applied to the
|
| // scroll delta.
|
| + base::AutoReset<bool> reset(&is_scrolling_, true);
|
| if (is_direct_manipulation) {
|
| return ScrollLayerWithViewportSpaceDelta(
|
| layer_impl, gfx::PointF(viewport_point), delta);
|
| @@ -2803,6 +2831,7 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
|
| const gfx::Point& viewport_point,
|
| const gfx::Vector2dF& scroll_delta) {
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
|
| + base::AutoReset<bool> reset(&is_scrolling_, true);
|
| if (!CurrentlyScrollingLayer())
|
| return InputHandlerScrollResult();
|
|
|
| @@ -2877,6 +2906,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
|
| // input handler.
|
| UpdateRootLayerStateForSynchronousInputHandler();
|
|
|
| + // Update compositor worker mutations which may respond to scrolling.
|
| + Mutate(CurrentBeginFrameArgs().frame_time);
|
| +
|
| return scroll_result;
|
| }
|
|
|
|
|