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

Side by Side Diff: cc/test/fake_layer_tree_host_impl.cc

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/test/fake_layer_tree_host_impl.h" 5 #include "cc/test/fake_layer_tree_host_impl.h"
6 #include "cc/test/test_shared_bitmap_manager.h" 6 #include "cc/test/test_shared_bitmap_manager.h"
7 #include "cc/trees/layer_tree_impl.h" 7 #include "cc/trees/layer_tree_impl.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (current_frame_time_ticks_.is_null()) 47 if (current_frame_time_ticks_.is_null())
48 return LayerTreeHostImpl::CurrentFrameTimeTicks(); 48 return LayerTreeHostImpl::CurrentFrameTimeTicks();
49 return current_frame_time_ticks_; 49 return current_frame_time_ticks_;
50 } 50 }
51 51
52 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks( 52 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
53 base::TimeTicks current_frame_time_ticks) { 53 base::TimeTicks current_frame_time_ticks) {
54 current_frame_time_ticks_ = current_frame_time_ticks; 54 current_frame_time_ticks_ = current_frame_time_ticks;
55 } 55 }
56 56
57 int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) {
58 int num_children_that_draw_content = 0;
59 for (size_t i = 0; i < layer->children().size(); ++i) {
60 num_children_that_draw_content +=
61 RecursiveUpdateNumChildren(layer->children()[i]);
62 }
63 if (layer->DrawsContent() && layer->HasDelegatedContent())
64 num_children_that_draw_content += 1000;
65 layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content);
66 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0);
67 }
68
69 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() {
70 UpdateNumChildrenAndDrawProperties(active_tree());
71 }
72
73 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
74 LayerTreeImpl* layerTree) {
75 RecursiveUpdateNumChildren(layerTree->root_layer());
76 layerTree->UpdateDrawProperties();
77 }
78
57 } // namespace cc 79 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698