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