Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2401853003: CL for src perf tryjob to run smoothness.scrolling_tough_ad_cases benchmark on android-nexus5X plat… (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 return ScrollBeginImpl(scroll_state, viewport()->MainScrollLayer(), type); 2636 return ScrollBeginImpl(scroll_state, viewport()->MainScrollLayer(), type);
2637 } 2637 }
2638 2638
2639 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2639 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2640 ScrollState* scroll_state, 2640 ScrollState* scroll_state,
2641 InputHandler::ScrollInputType type) { 2641 InputHandler::ScrollInputType type) {
2642 ScrollStatus scroll_status; 2642 ScrollStatus scroll_status;
2643 scroll_status.main_thread_scrolling_reasons = 2643 scroll_status.main_thread_scrolling_reasons =
2644 MainThreadScrollingReason::kNotScrollingOnMain; 2644 MainThreadScrollingReason::kNotScrollingOnMain;
2645 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2645 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2646 2646 bool scroll_on_main_thread = false;
2647 LayerImpl* scrolling_layer_impl;
2647 // On Mac a scroll begin with |inertial_phase| = true happens to handle a 2648 // On Mac a scroll begin with |inertial_phase| = true happens to handle a
2648 // fling. 2649 // fling.
2649 if (scroll_state->is_in_inertial_phase()) 2650 if (scroll_state->is_in_inertial_phase()) {
2650 return FlingScrollBegin(); 2651 scrolling_layer_impl = CurrentlyScrollingLayer();
2652 } else {
2653 ClearCurrentlyScrollingLayer();
2651 2654
2652 ClearCurrentlyScrollingLayer(); 2655 gfx::Point viewport_point(scroll_state->position_x(),
2656 scroll_state->position_y());
2657 gfx::PointF device_viewport_point = gfx::ScalePoint(
2658 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2659 LayerImpl* layer_impl =
2660 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2661 if (layer_impl) {
2662 LayerImpl* scroll_layer_impl =
2663 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
2664 device_viewport_point);
2665 if (scroll_layer_impl &&
2666 !HasScrollAncestor(layer_impl, scroll_layer_impl)) {
2667 scroll_status.thread = SCROLL_UNKNOWN;
2668 scroll_status.main_thread_scrolling_reasons =
2669 MainThreadScrollingReason::kFailedHitTest;
2670 return scroll_status;
2671 }
2672 }
2673 scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
2674 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2675 &scroll_status.main_thread_scrolling_reasons);
2653 2676
2654 gfx::Point viewport_point(scroll_state->position_x(), 2677 if (scrolling_layer_impl)
2655 scroll_state->position_y()); 2678 scroll_affects_scroll_handler_ =
2656 2679 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
2657 gfx::PointF device_viewport_point = gfx::ScalePoint(
2658 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2659 LayerImpl* layer_impl =
2660 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2661
2662 if (layer_impl) {
2663 LayerImpl* scroll_layer_impl =
2664 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
2665 device_viewport_point);
2666 if (scroll_layer_impl &&
2667 !HasScrollAncestor(layer_impl, scroll_layer_impl)) {
2668 scroll_status.thread = SCROLL_UNKNOWN;
2669 scroll_status.main_thread_scrolling_reasons =
2670 MainThreadScrollingReason::kFailedHitTest;
2671 return scroll_status;
2672 }
2673 } 2680 }
2674 2681
2675 bool scroll_on_main_thread = false;
2676 LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
2677 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2678 &scroll_status.main_thread_scrolling_reasons);
2679
2680 if (scrolling_layer_impl)
2681 scroll_affects_scroll_handler_ =
2682 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
2683
2684 if (scroll_on_main_thread) { 2682 if (scroll_on_main_thread) {
2685 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); 2683 RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
2686 2684
2687 scroll_status.thread = SCROLL_ON_MAIN_THREAD; 2685 scroll_status.thread = SCROLL_ON_MAIN_THREAD;
2688 return scroll_status; 2686 return scroll_status;
2689 } 2687 }
2690 2688
2691 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); 2689 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type);
2692 } 2690 }
2693 2691
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 accumulated_root_overscroll_ = gfx::Vector2dF(); 3169 accumulated_root_overscroll_ = gfx::Vector2dF();
3172 } 3170 }
3173 3171
3174 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { 3172 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
3175 DCHECK(scroll_state); 3173 DCHECK(scroll_state);
3176 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 3174 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
3177 3175
3178 DistributeScrollDelta(scroll_state); 3176 DistributeScrollDelta(scroll_state);
3179 top_controls_manager_->ScrollEnd(); 3177 top_controls_manager_->ScrollEnd();
3180 3178
3181 if (scroll_state->is_in_inertial_phase()) { 3179 if (!scroll_state->data()->fling_might_happen_next) {
3182 // Only clear the currently scrolling layer if we know the scroll is done. 3180 // Only clear the currently scrolling layer if we know the scroll is done.
3183 // A non-inertial scroll end could be followed by an inertial scroll.
3184 ClearCurrentlyScrollingLayer(); 3181 ClearCurrentlyScrollingLayer();
3185 } 3182 }
3186 } 3183 }
3187 3184
3188 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { 3185 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
3189 InputHandler::ScrollStatus scroll_status; 3186 InputHandler::ScrollStatus scroll_status;
3190 scroll_status.main_thread_scrolling_reasons = 3187 scroll_status.main_thread_scrolling_reasons =
3191 MainThreadScrollingReason::kNotScrollingOnMain; 3188 MainThreadScrollingReason::kNotScrollingOnMain;
3192 if (!CurrentlyScrollingLayer()) { 3189 if (!CurrentlyScrollingLayer()) {
3193 scroll_status.thread = SCROLL_IGNORED; 3190 scroll_status.thread = SCROLL_IGNORED;
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 if (is_visible) { 4085 if (is_visible) {
4089 worker_context_visibility_ = 4086 worker_context_visibility_ =
4090 worker_context->CacheController()->ClientBecameVisible(); 4087 worker_context->CacheController()->ClientBecameVisible();
4091 } else { 4088 } else {
4092 worker_context->CacheController()->ClientBecameNotVisible( 4089 worker_context->CacheController()->ClientBecameNotVisible(
4093 std::move(worker_context_visibility_)); 4090 std::move(worker_context_visibility_));
4094 } 4091 }
4095 } 4092 }
4096 4093
4097 } // namespace cc 4094 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scroll_state_data.cc ('k') | content/browser/renderer_host/input/gesture_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698