OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 namespace { | 47 namespace { |
48 | 48 |
49 gpu::Mailbox MailboxFromChar(char value) { | 49 gpu::Mailbox MailboxFromChar(char value) { |
50 gpu::Mailbox mailbox; | 50 gpu::Mailbox mailbox; |
51 memset(mailbox.name, value, sizeof(mailbox.name)); | 51 memset(mailbox.name, value, sizeof(mailbox.name)); |
52 return mailbox; | 52 return mailbox; |
53 } | 53 } |
54 | 54 |
55 class MockLayerTreeHost : public LayerTreeHost { | 55 class MockLayerTreeHost : public LayerTreeHost { |
56 public: | 56 public: |
57 static scoped_ptr<MockLayerTreeHost> Create(FakeLayerTreeHostClient* client) { | 57 static scoped_ptr<MockLayerTreeHost> Create( |
| 58 FakeLayerTreeHostClient* client, |
| 59 TaskGraphRunner* task_graph_runner) { |
58 LayerTreeHost::InitParams params; | 60 LayerTreeHost::InitParams params; |
59 params.client = client; | 61 params.client = client; |
| 62 params.task_graph_runner = task_graph_runner; |
60 LayerTreeSettings settings; | 63 LayerTreeSettings settings; |
61 params.settings = &settings; | 64 params.settings = &settings; |
62 return make_scoped_ptr(new MockLayerTreeHost(client, ¶ms)); | 65 return make_scoped_ptr(new MockLayerTreeHost(client, ¶ms)); |
63 } | 66 } |
64 | 67 |
65 MOCK_METHOD0(SetNeedsCommit, void()); | 68 MOCK_METHOD0(SetNeedsCommit, void()); |
66 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 69 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
67 MOCK_METHOD0(StartRateLimiter, void()); | 70 MOCK_METHOD0(StartRateLimiter, void()); |
68 MOCK_METHOD0(StopRateLimiter, void()); | 71 MOCK_METHOD0(StopRateLimiter, void()); |
69 | 72 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 class TextureLayerTest : public testing::Test { | 186 class TextureLayerTest : public testing::Test { |
184 public: | 187 public: |
185 TextureLayerTest() | 188 TextureLayerTest() |
186 : fake_client_( | 189 : fake_client_( |
187 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), | 190 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), |
188 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 191 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), |
189 test_data_(&shared_bitmap_manager_) {} | 192 test_data_(&shared_bitmap_manager_) {} |
190 | 193 |
191 protected: | 194 protected: |
192 void SetUp() override { | 195 void SetUp() override { |
193 layer_tree_host_ = MockLayerTreeHost::Create(&fake_client_); | 196 layer_tree_host_ = |
| 197 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
194 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 198 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
195 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 199 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
196 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 200 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
197 } | 201 } |
198 | 202 |
199 void TearDown() override { | 203 void TearDown() override { |
200 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 204 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
201 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 205 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
202 | 206 |
203 layer_tree_host_->SetRootLayer(nullptr); | 207 layer_tree_host_->SetRootLayer(nullptr); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 TextureLayerMailboxIsActivatedDuringCommit); | 916 TextureLayerMailboxIsActivatedDuringCommit); |
913 | 917 |
914 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 918 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
915 protected: | 919 protected: |
916 TextureLayerImplWithMailboxTest() | 920 TextureLayerImplWithMailboxTest() |
917 : fake_client_( | 921 : fake_client_( |
918 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} | 922 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} |
919 | 923 |
920 void SetUp() override { | 924 void SetUp() override { |
921 TextureLayerTest::SetUp(); | 925 TextureLayerTest::SetUp(); |
922 layer_tree_host_ = MockLayerTreeHost::Create(&fake_client_); | 926 layer_tree_host_ = |
| 927 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
923 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); | 928 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); |
924 } | 929 } |
925 | 930 |
926 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { | 931 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { |
927 bool will_draw = layer->WillDraw( | 932 bool will_draw = layer->WillDraw( |
928 mode, host_impl_.active_tree()->resource_provider()); | 933 mode, host_impl_.active_tree()->resource_provider()); |
929 if (will_draw) | 934 if (will_draw) |
930 layer->DidDraw(host_impl_.active_tree()->resource_provider()); | 935 layer->DidDraw(host_impl_.active_tree()->resource_provider()); |
931 return will_draw; | 936 return will_draw; |
932 } | 937 } |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 int callback_count_; | 1548 int callback_count_; |
1544 scoped_refptr<Layer> root_; | 1549 scoped_refptr<Layer> root_; |
1545 scoped_refptr<TextureLayer> layer_; | 1550 scoped_refptr<TextureLayer> layer_; |
1546 }; | 1551 }; |
1547 | 1552 |
1548 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1553 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1549 TextureLayerWithMailboxImplThreadDeleted); | 1554 TextureLayerWithMailboxImplThreadDeleted); |
1550 | 1555 |
1551 } // namespace | 1556 } // namespace |
1552 } // namespace cc | 1557 } // namespace cc |
OLD | NEW |