OLD | NEW |
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/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
25 namespace { | 25 namespace { |
26 | 26 |
27 class MockLayerImpl : public LayerImpl { | 27 class MockLayerImpl : public LayerImpl { |
28 public: | 28 public: |
29 static scoped_ptr<MockLayerImpl> Create(LayerTreeImpl* tree_impl, | 29 static scoped_ptr<MockLayerImpl> Create(LayerTreeImpl* tree_impl, |
30 int layer_id) { | 30 int layer_id) { |
31 return make_scoped_ptr(new MockLayerImpl(tree_impl, layer_id)); | 31 return make_scoped_ptr(new MockLayerImpl(tree_impl, layer_id)); |
32 } | 32 } |
33 virtual ~MockLayerImpl() { | 33 ~MockLayerImpl() override { |
34 if (layer_impl_destruction_list_) | 34 if (layer_impl_destruction_list_) |
35 layer_impl_destruction_list_->push_back(id()); | 35 layer_impl_destruction_list_->push_back(id()); |
36 } | 36 } |
37 | 37 |
38 void SetLayerImplDestructionList(std::vector<int>* list) { | 38 void SetLayerImplDestructionList(std::vector<int>* list) { |
39 layer_impl_destruction_list_ = list; | 39 layer_impl_destruction_list_ = list; |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 MockLayerImpl(LayerTreeImpl* tree_impl, int layer_id) | 43 MockLayerImpl(LayerTreeImpl* tree_impl, int layer_id) |
44 : LayerImpl(tree_impl, layer_id), | 44 : LayerImpl(tree_impl, layer_id), |
45 layer_impl_destruction_list_(NULL) {} | 45 layer_impl_destruction_list_(NULL) {} |
46 | 46 |
47 std::vector<int>* layer_impl_destruction_list_; | 47 std::vector<int>* layer_impl_destruction_list_; |
48 }; | 48 }; |
49 | 49 |
50 class MockLayer : public Layer { | 50 class MockLayer : public Layer { |
51 public: | 51 public: |
52 static scoped_refptr<MockLayer> Create( | 52 static scoped_refptr<MockLayer> Create( |
53 std::vector<int>* layer_impl_destruction_list) { | 53 std::vector<int>* layer_impl_destruction_list) { |
54 return make_scoped_refptr(new MockLayer(layer_impl_destruction_list)); | 54 return make_scoped_refptr(new MockLayer(layer_impl_destruction_list)); |
55 } | 55 } |
56 | 56 |
57 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 57 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { |
58 override { | |
59 return MockLayerImpl::Create(tree_impl, layer_id_); | 58 return MockLayerImpl::Create(tree_impl, layer_id_); |
60 } | 59 } |
61 | 60 |
62 virtual void PushPropertiesTo(LayerImpl* layer_impl) override { | 61 void PushPropertiesTo(LayerImpl* layer_impl) override { |
63 Layer::PushPropertiesTo(layer_impl); | 62 Layer::PushPropertiesTo(layer_impl); |
64 | 63 |
65 MockLayerImpl* mock_layer_impl = static_cast<MockLayerImpl*>(layer_impl); | 64 MockLayerImpl* mock_layer_impl = static_cast<MockLayerImpl*>(layer_impl); |
66 mock_layer_impl->SetLayerImplDestructionList(layer_impl_destruction_list_); | 65 mock_layer_impl->SetLayerImplDestructionList(layer_impl_destruction_list_); |
67 } | 66 } |
68 | 67 |
69 private: | 68 private: |
70 explicit MockLayer(std::vector<int>* layer_impl_destruction_list) | 69 explicit MockLayer(std::vector<int>* layer_impl_destruction_list) |
71 : Layer(), layer_impl_destruction_list_(layer_impl_destruction_list) {} | 70 : Layer(), layer_impl_destruction_list_(layer_impl_destruction_list) {} |
72 virtual ~MockLayer() {} | 71 ~MockLayer() override {} |
73 | 72 |
74 std::vector<int>* layer_impl_destruction_list_; | 73 std::vector<int>* layer_impl_destruction_list_; |
75 }; | 74 }; |
76 | 75 |
77 class FakeLayerAnimationController : public LayerAnimationController { | 76 class FakeLayerAnimationController : public LayerAnimationController { |
78 public: | 77 public: |
79 static scoped_refptr<LayerAnimationController> Create() { | 78 static scoped_refptr<LayerAnimationController> Create() { |
80 return static_cast<LayerAnimationController*>( | 79 return static_cast<LayerAnimationController*>( |
81 new FakeLayerAnimationController); | 80 new FakeLayerAnimationController); |
82 } | 81 } |
83 | 82 |
84 bool SynchronizedAnimations() const { return synchronized_animations_; } | 83 bool SynchronizedAnimations() const { return synchronized_animations_; } |
85 | 84 |
86 private: | 85 private: |
87 FakeLayerAnimationController() | 86 FakeLayerAnimationController() |
88 : LayerAnimationController(1), | 87 : LayerAnimationController(1), |
89 synchronized_animations_(false) {} | 88 synchronized_animations_(false) {} |
90 | 89 |
91 virtual ~FakeLayerAnimationController() {} | 90 ~FakeLayerAnimationController() override {} |
92 | 91 |
93 virtual void PushAnimationUpdatesTo(LayerAnimationController* controller_impl) | 92 void PushAnimationUpdatesTo( |
94 override { | 93 LayerAnimationController* controller_impl) override { |
95 LayerAnimationController::PushAnimationUpdatesTo(controller_impl); | 94 LayerAnimationController::PushAnimationUpdatesTo(controller_impl); |
96 synchronized_animations_ = true; | 95 synchronized_animations_ = true; |
97 } | 96 } |
98 | 97 |
99 bool synchronized_animations_; | 98 bool synchronized_animations_; |
100 }; | 99 }; |
101 | 100 |
102 void ExpectTreesAreIdentical(Layer* layer, | 101 void ExpectTreesAreIdentical(Layer* layer, |
103 LayerImpl* layer_impl, | 102 LayerImpl* layer_impl, |
104 LayerTreeImpl* tree_impl) { | 103 LayerTreeImpl* tree_impl) { |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 host_impl->active_tree()); | 742 host_impl->active_tree()); |
744 | 743 |
745 // The clip children should have been unhooked. | 744 // The clip children should have been unhooked. |
746 EXPECT_EQ(2u, intervening->children().size()); | 745 EXPECT_EQ(2u, intervening->children().size()); |
747 EXPECT_FALSE(clip_child2->clip_parent()); | 746 EXPECT_FALSE(clip_child2->clip_parent()); |
748 EXPECT_FALSE(additional_clip_child->clip_parent()); | 747 EXPECT_FALSE(additional_clip_child->clip_parent()); |
749 } | 748 } |
750 | 749 |
751 } // namespace | 750 } // namespace |
752 } // namespace cc | 751 } // namespace cc |
OLD | NEW |