| 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/base/thread.h" | |
| 10 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
| 12 #include "cc/test/animation_test_common.h" | 11 #include "cc/test/animation_test_common.h" |
| 13 #include "cc/test/fake_impl_proxy.h" | 12 #include "cc/test/fake_impl_proxy.h" |
| 14 #include "cc/test/fake_layer_tree_host_client.h" | 13 #include "cc/test/fake_layer_tree_host_client.h" |
| 15 #include "cc/test/fake_layer_tree_host_impl.h" | 14 #include "cc/test/fake_layer_tree_host_impl.h" |
| 16 #include "cc/test/geometry_test_utils.h" | 15 #include "cc/test/geometry_test_utils.h" |
| 17 #include "cc/test/layer_test_common.h" | 16 #include "cc/test/layer_test_common.h" |
| 18 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
| 19 #include "cc/trees/single_thread_proxy.h" | 18 #include "cc/trees/single_thread_proxy.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 } while (false) | 33 } while (false) |
| 35 | 34 |
| 36 | 35 |
| 37 namespace cc { | 36 namespace cc { |
| 38 namespace { | 37 namespace { |
| 39 | 38 |
| 40 class MockLayerTreeHost : public LayerTreeHost { | 39 class MockLayerTreeHost : public LayerTreeHost { |
| 41 public: | 40 public: |
| 42 explicit MockLayerTreeHost(LayerTreeHostClient* client) | 41 explicit MockLayerTreeHost(LayerTreeHostClient* client) |
| 43 : LayerTreeHost(client, LayerTreeSettings()) { | 42 : LayerTreeHost(client, LayerTreeSettings()) { |
| 44 Initialize(scoped_ptr<Thread>()); | 43 Initialize(scoped_refptr<base::SingleThreadTaskRunner>()); |
| 45 } | 44 } |
| 46 | 45 |
| 47 MOCK_METHOD0(SetNeedsCommit, void()); | 46 MOCK_METHOD0(SetNeedsCommit, void()); |
| 48 MOCK_METHOD0(SetNeedsFullTreeSync, void()); | 47 MOCK_METHOD0(SetNeedsFullTreeSync, void()); |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 class MockLayerPainter : public LayerPainter { | 50 class MockLayerPainter : public LayerPainter { |
| 52 public: | 51 public: |
| 53 virtual void Paint(SkCanvas* canvas, | 52 virtual void Paint(SkCanvas* canvas, |
| 54 gfx::Rect content_rect, | 53 gfx::Rect content_rect, |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 EXPECT_EQ(replica, replica->mask_layer()->parent()); | 727 EXPECT_EQ(replica, replica->mask_layer()->parent()); |
| 729 } | 728 } |
| 730 | 729 |
| 731 class LayerTreeHostFactory { | 730 class LayerTreeHostFactory { |
| 732 public: | 731 public: |
| 733 LayerTreeHostFactory() | 732 LayerTreeHostFactory() |
| 734 : client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 733 : client_(FakeLayerTreeHostClient::DIRECT_3D) {} |
| 735 | 734 |
| 736 scoped_ptr<LayerTreeHost> Create() { | 735 scoped_ptr<LayerTreeHost> Create() { |
| 737 return LayerTreeHost::Create( | 736 return LayerTreeHost::Create( |
| 738 &client_, LayerTreeSettings(), scoped_ptr<Thread>()).Pass(); | 737 &client_, |
| 738 LayerTreeSettings(), |
| 739 scoped_refptr<base::SingleThreadTaskRunner>()).Pass(); |
| 739 } | 740 } |
| 740 | 741 |
| 741 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { | 742 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { |
| 742 return LayerTreeHost::Create(&client_, settings, scoped_ptr<Thread>()) | 743 return LayerTreeHost::Create( |
| 743 .Pass(); | 744 &client_, |
| 745 settings, |
| 746 scoped_refptr<base::SingleThreadTaskRunner>()).Pass(); |
| 744 } | 747 } |
| 745 | 748 |
| 746 private: | 749 private: |
| 747 FakeLayerTreeHostClient client_; | 750 FakeLayerTreeHostClient client_; |
| 748 }; | 751 }; |
| 749 | 752 |
| 750 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { | 753 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { |
| 751 EXPECT_EQ(host, layer->layer_tree_host()); | 754 EXPECT_EQ(host, layer->layer_tree_host()); |
| 752 | 755 |
| 753 for (size_t i = 0; i < layer->children().size(); ++i) | 756 for (size_t i = 0; i < layer->children().size(); ++i) |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " | 1003 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " |
| 1001 << host_opaque << "\n"; | 1004 << host_opaque << "\n"; |
| 1002 } | 1005 } |
| 1003 } | 1006 } |
| 1004 } | 1007 } |
| 1005 } | 1008 } |
| 1006 } | 1009 } |
| 1007 | 1010 |
| 1008 } // namespace | 1011 } // namespace |
| 1009 } // namespace cc | 1012 } // namespace cc |
| OLD | NEW |