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 24 matching lines...) Expand all Loading... |
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, LayerTreeSettings()) { |
45 InitializeSingleThreaded(client, base::MessageLoopProxy::current()); | 45 InitializeSingleThreaded(client, |
| 46 base::MessageLoopProxy::current(), |
| 47 nullptr); |
46 } | 48 } |
47 | 49 |
48 MOCK_METHOD0(SetNeedsCommit, void()); | 50 MOCK_METHOD0(SetNeedsCommit, void()); |
49 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 51 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
50 MOCK_METHOD0(SetNeedsFullTreeSync, void()); | 52 MOCK_METHOD0(SetNeedsFullTreeSync, void()); |
51 }; | 53 }; |
52 | 54 |
53 class MockLayerPainter : public LayerPainter { | 55 class MockLayerPainter : public LayerPainter { |
54 public: | 56 public: |
55 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override {} | 57 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override {} |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 shared_bitmap_manager_(new TestSharedBitmapManager), | 930 shared_bitmap_manager_(new TestSharedBitmapManager), |
929 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager) {} | 931 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager) {} |
930 | 932 |
931 scoped_ptr<LayerTreeHost> Create() { | 933 scoped_ptr<LayerTreeHost> Create() { |
932 return LayerTreeHost::CreateSingleThreaded( | 934 return LayerTreeHost::CreateSingleThreaded( |
933 &client_, | 935 &client_, |
934 &client_, | 936 &client_, |
935 shared_bitmap_manager_.get(), | 937 shared_bitmap_manager_.get(), |
936 gpu_memory_buffer_manager_.get(), | 938 gpu_memory_buffer_manager_.get(), |
937 LayerTreeSettings(), | 939 LayerTreeSettings(), |
938 base::MessageLoopProxy::current()).Pass(); | 940 base::MessageLoopProxy::current(), |
| 941 nullptr); |
939 } | 942 } |
940 | 943 |
941 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { | 944 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { |
942 return LayerTreeHost::CreateSingleThreaded( | 945 return LayerTreeHost::CreateSingleThreaded( |
943 &client_, | 946 &client_, |
944 &client_, | 947 &client_, |
945 shared_bitmap_manager_.get(), | 948 shared_bitmap_manager_.get(), |
946 gpu_memory_buffer_manager_.get(), | 949 gpu_memory_buffer_manager_.get(), |
947 settings, | 950 settings, |
948 base::MessageLoopProxy::current()).Pass(); | 951 base::MessageLoopProxy::current(), |
| 952 nullptr); |
949 } | 953 } |
950 | 954 |
951 private: | 955 private: |
952 FakeLayerTreeHostClient client_; | 956 FakeLayerTreeHostClient client_; |
953 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 957 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
954 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 958 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
955 }; | 959 }; |
956 | 960 |
957 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { | 961 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { |
958 EXPECT_EQ(host, layer->layer_tree_host()); | 962 EXPECT_EQ(host, layer->layer_tree_host()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 root_layer->AddChild(becomes_not_draws_content); | 1248 root_layer->AddChild(becomes_not_draws_content); |
1245 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); | 1249 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); |
1246 | 1250 |
1247 becomes_draws_content->SetIsDrawable(true); | 1251 becomes_draws_content->SetIsDrawable(true); |
1248 root_layer->AddChild(becomes_draws_content); | 1252 root_layer->AddChild(becomes_draws_content); |
1249 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); | 1253 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); |
1250 } | 1254 } |
1251 | 1255 |
1252 } // namespace | 1256 } // namespace |
1253 } // namespace cc | 1257 } // namespace cc |
OLD | NEW |