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<BeginFrameSource> external_begin_frame_source) { | 16 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
16 scoped_ptr<ProxyMain> proxy_main( | 17 scoped_ptr<ProxyMainForTest> proxy_main( |
17 new ProxyMainForTest(test_hooks, host, task_runner_provider, | 18 new ProxyMainForTest(test_hooks, host, task_runner_provider, |
18 std::move(external_begin_frame_source))); | 19 std::move(external_begin_frame_source))); |
19 proxy_main->SetChannel(ThreadedChannelForTest::Create( | 20 scoped_ptr<ThreadedChannelForTest> channel = ThreadedChannelForTest::Create( |
20 test_hooks, proxy_main.get(), task_runner_provider)); | 21 test_hooks, proxy_main.get(), task_runner_provider); |
| 22 proxy_main->threaded_channel_for_test_ = channel.get(); |
| 23 proxy_main->SetChannel(std::move(channel)); |
21 return proxy_main; | 24 return proxy_main; |
22 } | 25 } |
23 | 26 |
| 27 scoped_ptr<ProxyMainForTest> ProxyMainForTest::CreateRemote( |
| 28 TestHooks* test_hooks, |
| 29 RemoteProtoChannel* remote_proto_channel, |
| 30 LayerTreeHost* host, |
| 31 TaskRunnerProvider* task_runner_provider) { |
| 32 scoped_ptr<ProxyMainForTest> proxy_main( |
| 33 new ProxyMainForTest(test_hooks, host, task_runner_provider, nullptr)); |
| 34 proxy_main->SetChannel(RemoteChannelMain::Create( |
| 35 remote_proto_channel, proxy_main.get(), task_runner_provider)); |
| 36 return proxy_main; |
| 37 } |
| 38 |
24 ProxyMainForTest::~ProxyMainForTest() {} | 39 ProxyMainForTest::~ProxyMainForTest() {} |
25 | 40 |
26 ProxyMainForTest::ProxyMainForTest( | 41 ProxyMainForTest::ProxyMainForTest( |
27 TestHooks* test_hooks, | 42 TestHooks* test_hooks, |
28 LayerTreeHost* host, | 43 LayerTreeHost* host, |
29 TaskRunnerProvider* task_runner_provider, | 44 TaskRunnerProvider* task_runner_provider, |
30 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 45 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
31 : ProxyMain(host, | 46 : ProxyMain(host, |
32 task_runner_provider, | 47 task_runner_provider, |
33 std::move(external_begin_frame_source)), | 48 std::move(external_begin_frame_source)), |
34 test_hooks_(test_hooks) {} | 49 test_hooks_(test_hooks), |
| 50 threaded_channel_for_test_(nullptr) {} |
35 | 51 |
36 void ProxyMainForTest::SetNeedsUpdateLayers() { | 52 void ProxyMainForTest::SetNeedsUpdateLayers() { |
37 ProxyMain::SetNeedsUpdateLayers(); | 53 ProxyMain::SetNeedsUpdateLayers(); |
38 test_hooks_->DidSetNeedsUpdateLayers(); | 54 test_hooks_->DidSetNeedsUpdateLayers(); |
39 } | 55 } |
40 | 56 |
41 void ProxyMainForTest::DidCompleteSwapBuffers() { | 57 void ProxyMainForTest::DidCompleteSwapBuffers() { |
42 test_hooks_->ReceivedDidCompleteSwapBuffers(); | 58 test_hooks_->ReceivedDidCompleteSwapBuffers(); |
43 ProxyMain::DidCompleteSwapBuffers(); | 59 ProxyMain::DidCompleteSwapBuffers(); |
44 } | 60 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 std::move(main_frame_events)); | 111 std::move(main_frame_events)); |
96 } | 112 } |
97 | 113 |
98 void ProxyMainForTest::BeginMainFrame( | 114 void ProxyMainForTest::BeginMainFrame( |
99 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 115 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
100 test_hooks_->ReceivedBeginMainFrame(); | 116 test_hooks_->ReceivedBeginMainFrame(); |
101 ProxyMain::BeginMainFrame(std::move(begin_main_frame_state)); | 117 ProxyMain::BeginMainFrame(std::move(begin_main_frame_state)); |
102 } | 118 } |
103 | 119 |
104 } // namespace cc | 120 } // namespace cc |
OLD | NEW |