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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 code_to_test; \ | 34 code_to_test; \ |
35 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ | 35 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ |
36 } while (false) | 36 } while (false) |
37 | 37 |
38 namespace cc { | 38 namespace cc { |
39 namespace { | 39 namespace { |
40 | 40 |
41 class MockLayerTreeHost : public LayerTreeHost { | 41 class MockLayerTreeHost : public LayerTreeHost { |
42 public: | 42 public: |
43 explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) | 43 explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) |
44 : LayerTreeHost(client, nullptr, nullptr, LayerTreeSettings()) { | 44 : LayerTreeHost(client, nullptr, nullptr, nullptr, LayerTreeSettings()) { |
45 InitializeSingleThreaded(client, | 45 InitializeSingleThreaded(client, |
46 base::MessageLoopProxy::current(), | 46 base::MessageLoopProxy::current(), |
47 nullptr); | 47 nullptr); |
48 } | 48 } |
49 | 49 |
50 MOCK_METHOD0(SetNeedsCommit, void()); | 50 MOCK_METHOD0(SetNeedsCommit, void()); |
51 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 51 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
52 MOCK_METHOD0(SetNeedsFullTreeSync, void()); | 52 MOCK_METHOD0(SetNeedsFullTreeSync, void()); |
53 }; | 53 }; |
54 | 54 |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 | 928 |
929 class LayerTreeHostFactory { | 929 class LayerTreeHostFactory { |
930 public: | 930 public: |
931 LayerTreeHostFactory() | 931 LayerTreeHostFactory() |
932 : client_(FakeLayerTreeHostClient::DIRECT_3D), | 932 : client_(FakeLayerTreeHostClient::DIRECT_3D), |
933 shared_bitmap_manager_(new TestSharedBitmapManager), | 933 shared_bitmap_manager_(new TestSharedBitmapManager), |
934 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager) {} | 934 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager) {} |
935 | 935 |
936 scoped_ptr<LayerTreeHost> Create() { | 936 scoped_ptr<LayerTreeHost> Create() { |
937 return LayerTreeHost::CreateSingleThreaded( | 937 return LayerTreeHost::CreateSingleThreaded( |
938 &client_, | 938 &client_, &client_, shared_bitmap_manager_.get(), |
939 &client_, | 939 gpu_memory_buffer_manager_.get(), nullptr, LayerTreeSettings(), |
940 shared_bitmap_manager_.get(), | 940 base::MessageLoopProxy::current(), nullptr); |
941 gpu_memory_buffer_manager_.get(), | |
942 LayerTreeSettings(), | |
943 base::MessageLoopProxy::current(), | |
944 nullptr); | |
945 } | 941 } |
946 | 942 |
947 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { | 943 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { |
948 return LayerTreeHost::CreateSingleThreaded( | 944 return LayerTreeHost::CreateSingleThreaded( |
949 &client_, | 945 &client_, &client_, shared_bitmap_manager_.get(), |
950 &client_, | 946 gpu_memory_buffer_manager_.get(), nullptr, settings, |
951 shared_bitmap_manager_.get(), | 947 base::MessageLoopProxy::current(), nullptr); |
952 gpu_memory_buffer_manager_.get(), | |
953 settings, | |
954 base::MessageLoopProxy::current(), | |
955 nullptr); | |
956 } | 948 } |
957 | 949 |
958 private: | 950 private: |
959 FakeLayerTreeHostClient client_; | 951 FakeLayerTreeHostClient client_; |
960 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 952 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
961 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 953 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
962 }; | 954 }; |
963 | 955 |
964 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { | 956 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { |
965 EXPECT_EQ(host, layer->layer_tree_host()); | 957 EXPECT_EQ(host, layer->layer_tree_host()); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 root_layer->AddChild(becomes_not_draws_content); | 1244 root_layer->AddChild(becomes_not_draws_content); |
1253 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); | 1245 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); |
1254 | 1246 |
1255 becomes_draws_content->SetIsDrawable(true); | 1247 becomes_draws_content->SetIsDrawable(true); |
1256 root_layer->AddChild(becomes_draws_content); | 1248 root_layer->AddChild(becomes_draws_content); |
1257 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); | 1249 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); |
1258 } | 1250 } |
1259 | 1251 |
1260 } // namespace | 1252 } // namespace |
1261 } // namespace cc | 1253 } // namespace cc |
OLD | NEW |