| 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 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return current_begin_frame_tracker_.DangerousMethodCurrentOrLast(); | 73 return current_begin_frame_tracker_.DangerousMethodCurrentOrLast(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void FakeLayerTreeHostImpl::AdvanceToNextFrame(base::TimeDelta advance_by) { | 76 void FakeLayerTreeHostImpl::AdvanceToNextFrame(base::TimeDelta advance_by) { |
| 77 BeginFrameArgs next_begin_frame_args = current_begin_frame_tracker_.Current(); | 77 BeginFrameArgs next_begin_frame_args = current_begin_frame_tracker_.Current(); |
| 78 next_begin_frame_args.frame_time += advance_by; | 78 next_begin_frame_args.frame_time += advance_by; |
| 79 DidFinishImplFrame(); | 79 DidFinishImplFrame(); |
| 80 WillBeginImplFrame(next_begin_frame_args); | 80 WillBeginImplFrame(next_begin_frame_args); |
| 81 } | 81 } |
| 82 | 82 |
| 83 int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) { | |
| 84 int num_children_that_draw_content = 0; | |
| 85 for (size_t i = 0; i < layer->test_properties()->children.size(); ++i) { | |
| 86 num_children_that_draw_content += | |
| 87 RecursiveUpdateNumChildren(layer->test_properties()->children[i]); | |
| 88 } | |
| 89 layer->test_properties()->num_descendants_that_draw_content = | |
| 90 num_children_that_draw_content; | |
| 91 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0); | |
| 92 } | |
| 93 | |
| 94 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() { | 83 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() { |
| 95 UpdateNumChildrenAndDrawProperties(active_tree()); | 84 UpdateNumChildrenAndDrawProperties(active_tree()); |
| 96 } | 85 } |
| 97 | 86 |
| 98 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties( | 87 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties( |
| 99 LayerTreeImpl* layerTree) { | 88 LayerTreeImpl* layerTree) { |
| 100 RecursiveUpdateNumChildren(layerTree->root_layer_for_testing()); | |
| 101 bool update_lcd_text = false; | 89 bool update_lcd_text = false; |
| 102 layerTree->BuildLayerListAndPropertyTreesForTesting(); | 90 layerTree->BuildLayerListAndPropertyTreesForTesting(); |
| 103 layerTree->UpdateDrawProperties(update_lcd_text); | 91 layerTree->UpdateDrawProperties(update_lcd_text); |
| 104 } | 92 } |
| 105 | 93 |
| 106 AnimationHost* FakeLayerTreeHostImpl::animation_host() const { | 94 AnimationHost* FakeLayerTreeHostImpl::animation_host() const { |
| 107 return static_cast<AnimationHost*>(mutator_host()); | 95 return static_cast<AnimationHost*>(mutator_host()); |
| 108 } | 96 } |
| 109 | 97 |
| 110 } // namespace cc | 98 } // namespace cc |
| OLD | NEW |