| 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 20 matching lines...) Expand all Loading... |
| 31 #include "cc/test/fake_impl_task_runner_provider.h" | 31 #include "cc/test/fake_impl_task_runner_provider.h" |
| 32 #include "cc/test/fake_layer_tree_host_client.h" | 32 #include "cc/test/fake_layer_tree_host_client.h" |
| 33 #include "cc/test/fake_layer_tree_host_impl.h" | 33 #include "cc/test/fake_layer_tree_host_impl.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/stub_layer_tree_host_single_thread_client.h" |
| 37 #include "cc/test/test_compositor_frame_sink.h" | 37 #include "cc/test/test_compositor_frame_sink.h" |
| 38 #include "cc/test/test_task_graph_runner.h" | 38 #include "cc/test/test_task_graph_runner.h" |
| 39 #include "cc/test/test_web_graphics_context_3d.h" | 39 #include "cc/test/test_web_graphics_context_3d.h" |
| 40 #include "cc/trees/blocking_task_runner.h" | 40 #include "cc/trees/blocking_task_runner.h" |
| 41 #include "cc/trees/layer_tree_host_in_process.h" | 41 #include "cc/trees/layer_tree_host.h" |
| 42 #include "cc/trees/layer_tree_impl.h" | 42 #include "cc/trees/layer_tree_impl.h" |
| 43 #include "cc/trees/single_thread_proxy.h" | 43 #include "cc/trees/single_thread_proxy.h" |
| 44 #include "gpu/GLES2/gl2extchromium.h" | 44 #include "gpu/GLES2/gl2extchromium.h" |
| 45 #include "testing/gmock/include/gmock/gmock.h" | 45 #include "testing/gmock/include/gmock/gmock.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 47 | 47 |
| 48 using ::testing::Mock; | 48 using ::testing::Mock; |
| 49 using ::testing::_; | 49 using ::testing::_; |
| 50 using ::testing::AtLeast; | 50 using ::testing::AtLeast; |
| 51 using ::testing::AnyNumber; | 51 using ::testing::AnyNumber; |
| 52 using ::testing::InvokeWithoutArgs; | 52 using ::testing::InvokeWithoutArgs; |
| 53 | 53 |
| 54 namespace cc { | 54 namespace cc { |
| 55 namespace { | 55 namespace { |
| 56 | 56 |
| 57 gpu::Mailbox MailboxFromChar(char value) { | 57 gpu::Mailbox MailboxFromChar(char value) { |
| 58 gpu::Mailbox mailbox; | 58 gpu::Mailbox mailbox; |
| 59 memset(mailbox.name, value, sizeof(mailbox.name)); | 59 memset(mailbox.name, value, sizeof(mailbox.name)); |
| 60 return mailbox; | 60 return mailbox; |
| 61 } | 61 } |
| 62 | 62 |
| 63 gpu::SyncToken SyncTokenFromUInt(uint32_t value) { | 63 gpu::SyncToken SyncTokenFromUInt(uint32_t value) { |
| 64 return gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0, | 64 return gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 65 gpu::CommandBufferId::FromUnsafeValue(0x123), value); | 65 gpu::CommandBufferId::FromUnsafeValue(0x123), value); |
| 66 } | 66 } |
| 67 | 67 |
| 68 class MockLayerTreeHost : public LayerTreeHostInProcess { | 68 class MockLayerTreeHost : public LayerTreeHost { |
| 69 public: | 69 public: |
| 70 static std::unique_ptr<MockLayerTreeHost> Create( | 70 static std::unique_ptr<MockLayerTreeHost> Create( |
| 71 FakeLayerTreeHostClient* client, | 71 FakeLayerTreeHostClient* client, |
| 72 TaskGraphRunner* task_graph_runner, | 72 TaskGraphRunner* task_graph_runner, |
| 73 MutatorHost* mutator_host) { | 73 MutatorHost* mutator_host) { |
| 74 LayerTreeHostInProcess::InitParams params; | 74 LayerTreeHost::InitParams params; |
| 75 params.client = client; | 75 params.client = client; |
| 76 params.task_graph_runner = task_graph_runner; | 76 params.task_graph_runner = task_graph_runner; |
| 77 params.mutator_host = mutator_host; | 77 params.mutator_host = mutator_host; |
| 78 LayerTreeSettings settings; | 78 LayerTreeSettings settings; |
| 79 settings.verify_clip_tree_calculations = true; | 79 settings.verify_clip_tree_calculations = true; |
| 80 params.settings = &settings; | 80 params.settings = &settings; |
| 81 return base::WrapUnique(new MockLayerTreeHost(¶ms)); | 81 return base::WrapUnique(new MockLayerTreeHost(¶ms)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 MOCK_METHOD0(SetNeedsCommit, void()); | 84 MOCK_METHOD0(SetNeedsCommit, void()); |
| 85 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 85 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
| 86 MOCK_METHOD0(StartRateLimiter, void()); | 86 MOCK_METHOD0(StartRateLimiter, void()); |
| 87 MOCK_METHOD0(StopRateLimiter, void()); | 87 MOCK_METHOD0(StopRateLimiter, void()); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 explicit MockLayerTreeHost(LayerTreeHostInProcess::InitParams* params) | 90 explicit MockLayerTreeHost(LayerTreeHost::InitParams* params) |
| 91 : LayerTreeHostInProcess(params, CompositorMode::SINGLE_THREADED) { | 91 : LayerTreeHost(params, CompositorMode::SINGLE_THREADED) { |
| 92 InitializeSingleThreaded(&single_thread_client_, | 92 InitializeSingleThreaded(&single_thread_client_, |
| 93 base::ThreadTaskRunnerHandle::Get()); | 93 base::ThreadTaskRunnerHandle::Get()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 StubLayerTreeHostSingleThreadClient single_thread_client_; | 96 StubLayerTreeHostSingleThreadClient single_thread_client_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class FakeTextureLayerClient : public TextureLayerClient { | 99 class FakeTextureLayerClient : public TextureLayerClient { |
| 100 public: | 100 public: |
| 101 FakeTextureLayerClient() : mailbox_changed_(true) {} | 101 FakeTextureLayerClient() : mailbox_changed_(true) {} |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 base::ThreadChecker main_thread_; | 1454 base::ThreadChecker main_thread_; |
| 1455 int callback_count_; | 1455 int callback_count_; |
| 1456 scoped_refptr<Layer> root_; | 1456 scoped_refptr<Layer> root_; |
| 1457 scoped_refptr<TextureLayer> layer_; | 1457 scoped_refptr<TextureLayer> layer_; |
| 1458 }; | 1458 }; |
| 1459 | 1459 |
| 1460 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); | 1460 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); |
| 1461 | 1461 |
| 1462 } // namespace | 1462 } // namespace |
| 1463 } // namespace cc | 1463 } // namespace cc |
| OLD | NEW |