| 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 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 |
| OLD | NEW |