OLD | NEW |
---|---|
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 Loading... | |
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 layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content); | |
64 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0) + | |
65 (layer->HasDelegatedContent() ? 1000 : 0); | |
danakj
2014/07/17 17:21:25
It's unfortunate to require adding a virtual on La
awoloszyn
2014/07/17 20:45:00
I reworked the RecursiveUpdateNumChildren to behav
| |
66 } | |
67 | |
68 void FakeLayerTreeHostImpl::UpdateDrawProperties() { | |
danakj
2014/07/17 17:21:25
Let's name this to be more clear what it does from
awoloszyn
2014/07/17 20:45:00
Done.
| |
69 UpdateNumChildrenAndDrawProperties(active_tree()); | |
70 } | |
71 | |
72 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties( | |
73 LayerTreeImpl* layerTree) { | |
74 RecursiveUpdateNumChildren(layerTree->root_layer()); | |
75 layerTree->UpdateDrawProperties(); | |
76 } | |
77 | |
57 } // namespace cc | 78 } // namespace cc |
OLD | NEW |