OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 max_memory_needed_bytes_(0), | 230 max_memory_needed_bytes_(0), |
231 resourceless_software_draw_(false), | 231 resourceless_software_draw_(false), |
232 mutator_host_(std::move(mutator_host)), | 232 mutator_host_(std::move(mutator_host)), |
233 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 233 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
234 micro_benchmark_controller_(this), | 234 micro_benchmark_controller_(this), |
235 task_graph_runner_(task_graph_runner), | 235 task_graph_runner_(task_graph_runner), |
236 id_(id), | 236 id_(id), |
237 requires_high_res_to_draw_(false), | 237 requires_high_res_to_draw_(false), |
238 is_likely_to_require_a_draw_(false), | 238 is_likely_to_require_a_draw_(false), |
239 has_valid_compositor_frame_sink_(false), | 239 has_valid_compositor_frame_sink_(false), |
240 mutator_(nullptr) { | 240 mutator_(nullptr), |
| 241 has_scrolled_by_wheel_(false), |
| 242 has_scrolled_by_touch_(false) { |
241 DCHECK(mutator_host_); | 243 DCHECK(mutator_host_); |
242 mutator_host_->SetMutatorHostClient(this); | 244 mutator_host_->SetMutatorHostClient(this); |
243 | 245 |
244 DCHECK(task_runner_provider_->IsImplThread()); | 246 DCHECK(task_runner_provider_->IsImplThread()); |
245 DidVisibilityChange(this, visible_); | 247 DidVisibilityChange(this, visible_); |
246 | 248 |
247 SetDebugState(settings.initial_debug_state); | 249 SetDebugState(settings.initial_debug_state); |
248 | 250 |
249 // LTHI always has an active tree. | 251 // LTHI always has an active tree. |
250 active_tree_ = base::MakeUnique<LayerTreeImpl>( | 252 active_tree_ = base::MakeUnique<LayerTreeImpl>( |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 // in input_handler_proxy instead. | 2690 // in input_handler_proxy instead. |
2689 wheel_scrolling_ = IsWheelBasedScroll(type); | 2691 wheel_scrolling_ = IsWheelBasedScroll(type); |
2690 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); | 2692 scroll_state->set_is_direct_manipulation(!wheel_scrolling_); |
2691 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure | 2693 // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure |
2692 // scroll customization callbacks are invoked. | 2694 // scroll customization callbacks are invoked. |
2693 DistributeScrollDelta(scroll_state); | 2695 DistributeScrollDelta(scroll_state); |
2694 | 2696 |
2695 client_->RenewTreePriority(); | 2697 client_->RenewTreePriority(); |
2696 RecordCompositorSlowScrollMetric(type, CC_THREAD); | 2698 RecordCompositorSlowScrollMetric(type, CC_THREAD); |
2697 | 2699 |
| 2700 UpdateScrollSourceInfo(wheel_scrolling_); |
| 2701 |
2698 return scroll_status; | 2702 return scroll_status; |
2699 } | 2703 } |
2700 | 2704 |
2701 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( | 2705 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( |
2702 ScrollState* scroll_state, | 2706 ScrollState* scroll_state, |
2703 InputHandler::ScrollInputType type) { | 2707 InputHandler::ScrollInputType type) { |
2704 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); | 2708 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); |
2705 | 2709 |
2706 ClearCurrentlyScrollingNode(); | 2710 ClearCurrentlyScrollingNode(); |
2707 | 2711 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3508 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); | 3512 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); |
3509 CollectScrollbarUpdates(scroll_info.get(), &scrollbar_animation_controllers_); | 3513 CollectScrollbarUpdates(scroll_info.get(), &scrollbar_animation_controllers_); |
3510 scroll_info->page_scale_delta = | 3514 scroll_info->page_scale_delta = |
3511 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3515 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
3512 scroll_info->top_controls_delta = | 3516 scroll_info->top_controls_delta = |
3513 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3517 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
3514 scroll_info->elastic_overscroll_delta = | 3518 scroll_info->elastic_overscroll_delta = |
3515 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); | 3519 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); |
3516 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); | 3520 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); |
3517 | 3521 |
| 3522 // Record and reset scroll source flags. |
| 3523 scroll_info->has_scrolled_by_wheel = has_scrolled_by_wheel_; |
| 3524 scroll_info->has_scrolled_by_touch = has_scrolled_by_touch_; |
| 3525 has_scrolled_by_wheel_ = has_scrolled_by_touch_ = false; |
| 3526 |
3518 return scroll_info; | 3527 return scroll_info; |
3519 } | 3528 } |
3520 | 3529 |
3521 void LayerTreeHostImpl::SetFullViewportDamage() { | 3530 void LayerTreeHostImpl::SetFullViewportDamage() { |
3522 SetViewportDamage(gfx::Rect(DrawViewportSize())); | 3531 SetViewportDamage(gfx::Rect(DrawViewportSize())); |
3523 } | 3532 } |
3524 | 3533 |
3525 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { | 3534 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { |
3526 if (!page_scale_animation_) | 3535 if (!page_scale_animation_) |
3527 return false; | 3536 return false; |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4210 if (is_visible) { | 4219 if (is_visible) { |
4211 worker_context_visibility_ = | 4220 worker_context_visibility_ = |
4212 worker_context->CacheController()->ClientBecameVisible(); | 4221 worker_context->CacheController()->ClientBecameVisible(); |
4213 } else { | 4222 } else { |
4214 worker_context->CacheController()->ClientBecameNotVisible( | 4223 worker_context->CacheController()->ClientBecameNotVisible( |
4215 std::move(worker_context_visibility_)); | 4224 std::move(worker_context_visibility_)); |
4216 } | 4225 } |
4217 } | 4226 } |
4218 } | 4227 } |
4219 | 4228 |
| 4229 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4230 if (is_wheel_scroll) |
| 4231 has_scrolled_by_wheel_ = true; |
| 4232 else |
| 4233 has_scrolled_by_touch_ = true; |
| 4234 } |
| 4235 |
4220 } // namespace cc | 4236 } // namespace cc |
OLD | NEW |