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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "cc/layers/texture_layer_client.h" | 26 #include "cc/layers/texture_layer_client.h" |
27 #include "cc/layers/texture_layer_impl.h" | 27 #include "cc/layers/texture_layer_impl.h" |
28 #include "cc/output/context_provider.h" | 28 #include "cc/output/context_provider.h" |
29 #include "cc/resources/returned_resource.h" | 29 #include "cc/resources/returned_resource.h" |
30 #include "cc/test/fake_impl_task_runner_provider.h" | 30 #include "cc/test/fake_impl_task_runner_provider.h" |
31 #include "cc/test/fake_layer_tree_host_client.h" | 31 #include "cc/test/fake_layer_tree_host_client.h" |
32 #include "cc/test/fake_layer_tree_host_impl.h" | 32 #include "cc/test/fake_layer_tree_host_impl.h" |
33 #include "cc/test/fake_output_surface.h" | 33 #include "cc/test/fake_output_surface.h" |
34 #include "cc/test/layer_test_common.h" | 34 #include "cc/test/layer_test_common.h" |
35 #include "cc/test/layer_tree_test.h" | 35 #include "cc/test/layer_tree_test.h" |
| 36 #include "cc/test/stub_layer_tree_host_single_thread_client.h" |
36 #include "cc/test/test_task_graph_runner.h" | 37 #include "cc/test/test_task_graph_runner.h" |
37 #include "cc/test/test_web_graphics_context_3d.h" | 38 #include "cc/test/test_web_graphics_context_3d.h" |
38 #include "cc/trees/blocking_task_runner.h" | 39 #include "cc/trees/blocking_task_runner.h" |
39 #include "cc/trees/layer_tree_host.h" | 40 #include "cc/trees/layer_tree_host.h" |
40 #include "cc/trees/layer_tree_impl.h" | 41 #include "cc/trees/layer_tree_impl.h" |
41 #include "cc/trees/single_thread_proxy.h" | 42 #include "cc/trees/single_thread_proxy.h" |
42 #include "gpu/GLES2/gl2extchromium.h" | 43 #include "gpu/GLES2/gl2extchromium.h" |
43 #include "testing/gmock/include/gmock/gmock.h" | 44 #include "testing/gmock/include/gmock/gmock.h" |
44 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
45 | 46 |
(...skipping 22 matching lines...) Expand all Loading... |
68 static std::unique_ptr<MockLayerTreeHost> Create( | 69 static std::unique_ptr<MockLayerTreeHost> Create( |
69 FakeLayerTreeHostClient* client, | 70 FakeLayerTreeHostClient* client, |
70 TaskGraphRunner* task_graph_runner) { | 71 TaskGraphRunner* task_graph_runner) { |
71 LayerTreeHost::InitParams params; | 72 LayerTreeHost::InitParams params; |
72 params.client = client; | 73 params.client = client; |
73 params.task_graph_runner = task_graph_runner; | 74 params.task_graph_runner = task_graph_runner; |
74 params.animation_host = | 75 params.animation_host = |
75 AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 76 AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
76 LayerTreeSettings settings; | 77 LayerTreeSettings settings; |
77 params.settings = &settings; | 78 params.settings = &settings; |
78 return base::WrapUnique(new MockLayerTreeHost(client, ¶ms)); | 79 return base::WrapUnique(new MockLayerTreeHost(¶ms)); |
79 } | 80 } |
80 | 81 |
81 MOCK_METHOD0(SetNeedsCommit, void()); | 82 MOCK_METHOD0(SetNeedsCommit, void()); |
82 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 83 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
83 MOCK_METHOD0(StartRateLimiter, void()); | 84 MOCK_METHOD0(StartRateLimiter, void()); |
84 MOCK_METHOD0(StopRateLimiter, void()); | 85 MOCK_METHOD0(StopRateLimiter, void()); |
85 | 86 |
86 private: | 87 private: |
87 MockLayerTreeHost(FakeLayerTreeHostClient* client, | 88 explicit MockLayerTreeHost(LayerTreeHost::InitParams* params) |
88 LayerTreeHost::InitParams* params) | |
89 : LayerTreeHost(params, CompositorMode::SINGLE_THREADED) { | 89 : LayerTreeHost(params, CompositorMode::SINGLE_THREADED) { |
90 InitializeSingleThreaded(client, base::ThreadTaskRunnerHandle::Get(), | 90 InitializeSingleThreaded(&single_thread_client_, |
91 nullptr); | 91 base::ThreadTaskRunnerHandle::Get(), nullptr); |
92 } | 92 } |
| 93 |
| 94 StubLayerTreeHostSingleThreadClient single_thread_client_; |
93 }; | 95 }; |
94 | 96 |
95 class FakeTextureLayerClient : public TextureLayerClient { | 97 class FakeTextureLayerClient : public TextureLayerClient { |
96 public: | 98 public: |
97 FakeTextureLayerClient() : mailbox_changed_(true) {} | 99 FakeTextureLayerClient() : mailbox_changed_(true) {} |
98 | 100 |
99 bool PrepareTextureMailbox( | 101 bool PrepareTextureMailbox( |
100 TextureMailbox* mailbox, | 102 TextureMailbox* mailbox, |
101 std::unique_ptr<SingleReleaseCallback>* release_callback, | 103 std::unique_ptr<SingleReleaseCallback>* release_callback, |
102 bool use_shared_memory) override { | 104 bool use_shared_memory) override { |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 int callback_count_; | 1447 int callback_count_; |
1446 scoped_refptr<Layer> root_; | 1448 scoped_refptr<Layer> root_; |
1447 scoped_refptr<TextureLayer> layer_; | 1449 scoped_refptr<TextureLayer> layer_; |
1448 }; | 1450 }; |
1449 | 1451 |
1450 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1452 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1451 TextureLayerWithMailboxImplThreadDeleted); | 1453 TextureLayerWithMailboxImplThreadDeleted); |
1452 | 1454 |
1453 } // namespace | 1455 } // namespace |
1454 } // namespace cc | 1456 } // namespace cc |
OLD | NEW |