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

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

Issue 2720183003: Track the currently scrolling ScrollNode instead of the scrolling layer (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.h » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 CalculateDrawPropertiesInternal(inputs, DONT_BUILD_PROPERTY_TREES); 597 CalculateDrawPropertiesInternal(inputs, DONT_BUILD_PROPERTY_TREES);
598 598
599 if (CdpPerfTracingEnabled()) { 599 if (CdpPerfTracingEnabled()) {
600 LayerTreeImpl* layer_tree_impl = inputs->root_layer->layer_tree_impl(); 600 LayerTreeImpl* layer_tree_impl = inputs->root_layer->layer_tree_impl();
601 if (layer_tree_impl->IsPendingTree() && 601 if (layer_tree_impl->IsPendingTree() &&
602 layer_tree_impl->is_first_frame_after_commit()) { 602 layer_tree_impl->is_first_frame_after_commit()) {
603 LayerImpl* active_tree_root = 603 LayerImpl* active_tree_root =
604 layer_tree_impl->FindActiveTreeLayerById(inputs->root_layer->id()); 604 layer_tree_impl->FindActiveTreeLayerById(inputs->root_layer->id());
605 float jitter = 0.f; 605 float jitter = 0.f;
606 if (active_tree_root) { 606 if (active_tree_root) {
607 LayerImpl* last_scrolled_layer = layer_tree_impl->LayerById( 607 int last_scrolled_node_index =
608 active_tree_root->layer_tree_impl()->LastScrolledLayerId()); 608 active_tree_root->layer_tree_impl()->LastScrolledScrollNodeIndex();
609 if (last_scrolled_layer) { 609 if (last_scrolled_node_index) {
ajuma 2017/02/28 22:59:37 This needs to be compared to ScrollTree::kInvalidN
pdr. 2017/03/01 07:21:03 Done
610 const int last_scrolled_scroll_node_id =
611 last_scrolled_layer->scroll_tree_index();
612 std::unordered_set<int> jitter_nodes; 610 std::unordered_set<int> jitter_nodes;
613 for (auto* layer : *layer_tree_impl) { 611 for (auto* layer : *layer_tree_impl) {
614 // Layers that have the same scroll tree index jitter together. So, 612 // Layers that have the same scroll tree index jitter together. So,
615 // it is enough to calculate jitter on one of these layers. So, 613 // it is enough to calculate jitter on one of these layers. So,
616 // after we find a jittering layer, we need not consider other 614 // after we find a jittering layer, we need not consider other
617 // layers with the same scroll tree index. 615 // layers with the same scroll tree index.
618 int scroll_tree_index = layer->scroll_tree_index(); 616 int scroll_tree_index = layer->scroll_tree_index();
619 if (last_scrolled_scroll_node_id <= scroll_tree_index && 617 if (last_scrolled_node_index <= scroll_tree_index &&
620 jitter_nodes.find(scroll_tree_index) == jitter_nodes.end()) { 618 jitter_nodes.find(scroll_tree_index) == jitter_nodes.end()) {
621 float layer_jitter = CalculateLayerJitter(layer); 619 float layer_jitter = CalculateLayerJitter(layer);
622 if (layer_jitter > 0.f) { 620 if (layer_jitter > 0.f) {
623 jitter_nodes.insert(layer->scroll_tree_index()); 621 jitter_nodes.insert(layer->scroll_tree_index());
624 jitter += layer_jitter; 622 jitter += layer_jitter;
625 } 623 }
626 } 624 }
627 } 625 }
628 } 626 }
629 } 627 }
(...skipping 20 matching lines...) Expand all
650 648
651 PropertyTrees* GetPropertyTrees(Layer* layer) { 649 PropertyTrees* GetPropertyTrees(Layer* layer) {
652 return layer->layer_tree_host()->property_trees(); 650 return layer->layer_tree_host()->property_trees();
653 } 651 }
654 652
655 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 653 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
656 return layer->layer_tree_impl()->property_trees(); 654 return layer->layer_tree_impl()->property_trees();
657 } 655 }
658 656
659 } // namespace cc 657 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.h » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698