| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/proxy_main_for_test.h" | 5 #include "cc/test/proxy_main_for_test.h" |
| 6 | 6 |
| 7 #include "cc/test/threaded_channel_for_test.h" | 7 #include "cc/test/threaded_channel_for_test.h" |
| 8 #include "cc/trees/remote_channel_main.h" |
| 8 | 9 |
| 9 namespace cc { | 10 namespace cc { |
| 10 | 11 |
| 11 scoped_ptr<ProxyMain> ProxyMainForTest::CreateThreaded( | 12 scoped_ptr<ProxyMainForTest> ProxyMainForTest::CreateThreaded( |
| 12 TestHooks* test_hooks, | 13 TestHooks* test_hooks, |
| 13 LayerTreeHost* host, | 14 LayerTreeHost* host, |
| 14 TaskRunnerProvider* task_runner_provider) { | 15 TaskRunnerProvider* task_runner_provider) { |
| 15 scoped_ptr<ProxyMain> proxy_main( | 16 scoped_ptr<ProxyMainForTest> proxy_main( |
| 16 new ProxyMainForTest(test_hooks, host, task_runner_provider)); | 17 new ProxyMainForTest(test_hooks, host, task_runner_provider)); |
| 17 proxy_main->SetChannel(ThreadedChannelForTest::Create( | 18 scoped_ptr<ThreadedChannelForTest> channel = ThreadedChannelForTest::Create( |
| 18 test_hooks, proxy_main.get(), task_runner_provider)); | 19 test_hooks, proxy_main.get(), task_runner_provider); |
| 20 proxy_main->threaded_channel_for_test_ = channel.get(); |
| 21 proxy_main->SetChannel(std::move(channel)); |
| 19 return proxy_main; | 22 return proxy_main; |
| 20 } | 23 } |
| 21 | 24 |
| 25 scoped_ptr<ProxyMainForTest> ProxyMainForTest::CreateRemote( |
| 26 TestHooks* test_hooks, |
| 27 RemoteProtoChannel* remote_proto_channel, |
| 28 LayerTreeHost* host, |
| 29 TaskRunnerProvider* task_runner_provider) { |
| 30 scoped_ptr<ProxyMainForTest> proxy_main( |
| 31 new ProxyMainForTest(test_hooks, host, task_runner_provider)); |
| 32 proxy_main->SetChannel(RemoteChannelMain::Create( |
| 33 remote_proto_channel, proxy_main.get(), task_runner_provider)); |
| 34 return proxy_main; |
| 35 } |
| 36 |
| 22 ProxyMainForTest::~ProxyMainForTest() {} | 37 ProxyMainForTest::~ProxyMainForTest() {} |
| 23 | 38 |
| 24 ProxyMainForTest::ProxyMainForTest(TestHooks* test_hooks, | 39 ProxyMainForTest::ProxyMainForTest(TestHooks* test_hooks, |
| 25 LayerTreeHost* host, | 40 LayerTreeHost* host, |
| 26 TaskRunnerProvider* task_runner_provider) | 41 TaskRunnerProvider* task_runner_provider) |
| 27 : ProxyMain(host, task_runner_provider), test_hooks_(test_hooks) {} | 42 : ProxyMain(host, task_runner_provider), |
| 43 test_hooks_(test_hooks), |
| 44 threaded_channel_for_test_(nullptr) {} |
| 28 | 45 |
| 29 void ProxyMainForTest::SetNeedsUpdateLayers() { | 46 void ProxyMainForTest::SetNeedsUpdateLayers() { |
| 30 ProxyMain::SetNeedsUpdateLayers(); | 47 ProxyMain::SetNeedsUpdateLayers(); |
| 31 test_hooks_->DidSetNeedsUpdateLayers(); | 48 test_hooks_->DidSetNeedsUpdateLayers(); |
| 32 } | 49 } |
| 33 | 50 |
| 34 void ProxyMainForTest::DidCompleteSwapBuffers() { | 51 void ProxyMainForTest::DidCompleteSwapBuffers() { |
| 35 test_hooks_->ReceivedDidCompleteSwapBuffers(); | 52 test_hooks_->ReceivedDidCompleteSwapBuffers(); |
| 36 ProxyMain::DidCompleteSwapBuffers(); | 53 ProxyMain::DidCompleteSwapBuffers(); |
| 37 } | 54 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 std::move(main_frame_events)); | 105 std::move(main_frame_events)); |
| 89 } | 106 } |
| 90 | 107 |
| 91 void ProxyMainForTest::BeginMainFrame( | 108 void ProxyMainForTest::BeginMainFrame( |
| 92 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 109 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
| 93 test_hooks_->ReceivedBeginMainFrame(); | 110 test_hooks_->ReceivedBeginMainFrame(); |
| 94 ProxyMain::BeginMainFrame(std::move(begin_main_frame_state)); | 111 ProxyMain::BeginMainFrame(std::move(begin_main_frame_state)); |
| 95 } | 112 } |
| 96 | 113 |
| 97 } // namespace cc | 114 } // namespace cc |
| OLD | NEW |