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/animation/animation_events.h" | 7 #include "cc/animation/animation_events.h" |
8 #include "cc/test/threaded_channel_for_test.h" | 8 #include "cc/test/threaded_channel_for_test.h" |
| 9 #include "cc/trees/remote_channel_main.h" |
9 | 10 |
10 namespace cc { | 11 namespace cc { |
11 | 12 |
12 scoped_ptr<ProxyMain> ProxyMainForTest::CreateThreaded( | 13 scoped_ptr<ProxyMainForTest> ProxyMainForTest::CreateThreaded( |
13 TestHooks* test_hooks, | 14 TestHooks* test_hooks, |
14 LayerTreeHost* host, | 15 LayerTreeHost* host, |
15 TaskRunnerProvider* task_runner_provider) { | 16 TaskRunnerProvider* task_runner_provider) { |
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 proxy_main->SetChannel(ThreadedChannelForTest::Create( | 19 scoped_ptr<ThreadedChannelForTest> channel = ThreadedChannelForTest::Create( |
19 test_hooks, proxy_main.get(), task_runner_provider)); | 20 test_hooks, proxy_main.get(), task_runner_provider); |
| 21 proxy_main->threaded_channel_for_test_ = channel.get(); |
| 22 proxy_main->SetChannel(std::move(channel)); |
20 return proxy_main; | 23 return proxy_main; |
21 } | 24 } |
22 | 25 |
| 26 scoped_ptr<ProxyMainForTest> ProxyMainForTest::CreateRemote( |
| 27 TestHooks* test_hooks, |
| 28 RemoteProtoChannel* remote_proto_channel, |
| 29 LayerTreeHost* host, |
| 30 TaskRunnerProvider* task_runner_provider) { |
| 31 scoped_ptr<ProxyMainForTest> proxy_main( |
| 32 new ProxyMainForTest(test_hooks, host, task_runner_provider)); |
| 33 proxy_main->SetChannel(RemoteChannelMain::Create( |
| 34 remote_proto_channel, proxy_main.get(), task_runner_provider)); |
| 35 return proxy_main; |
| 36 } |
| 37 |
23 ProxyMainForTest::~ProxyMainForTest() {} | 38 ProxyMainForTest::~ProxyMainForTest() {} |
24 | 39 |
25 ProxyMainForTest::ProxyMainForTest(TestHooks* test_hooks, | 40 ProxyMainForTest::ProxyMainForTest(TestHooks* test_hooks, |
26 LayerTreeHost* host, | 41 LayerTreeHost* host, |
27 TaskRunnerProvider* task_runner_provider) | 42 TaskRunnerProvider* task_runner_provider) |
28 : ProxyMain(host, task_runner_provider), test_hooks_(test_hooks) {} | 43 : ProxyMain(host, task_runner_provider), |
| 44 test_hooks_(test_hooks), |
| 45 threaded_channel_for_test_(nullptr) {} |
29 | 46 |
30 void ProxyMainForTest::SetNeedsUpdateLayers() { | 47 void ProxyMainForTest::SetNeedsUpdateLayers() { |
31 ProxyMain::SetNeedsUpdateLayers(); | 48 ProxyMain::SetNeedsUpdateLayers(); |
32 test_hooks_->DidSetNeedsUpdateLayers(); | 49 test_hooks_->DidSetNeedsUpdateLayers(); |
33 } | 50 } |
34 | 51 |
35 void ProxyMainForTest::DidCompleteSwapBuffers() { | 52 void ProxyMainForTest::DidCompleteSwapBuffers() { |
36 test_hooks_->ReceivedDidCompleteSwapBuffers(); | 53 test_hooks_->ReceivedDidCompleteSwapBuffers(); |
37 ProxyMain::DidCompleteSwapBuffers(); | 54 ProxyMain::DidCompleteSwapBuffers(); |
38 } | 55 } |
(...skipping 49 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 |