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/trees/threaded_channel.h" | 5 #include "cc/trees/threaded_channel.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/trees/layer_tree_host.h" | 10 #include "cc/trees/layer_tree_host.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
| 14 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( |
| 15 ProxyMain* proxy_main, |
| 16 TaskRunnerProvider* task_runner_provider) { |
| 17 return make_scoped_ptr(new ThreadedChannel(proxy_main, task_runner_provider)); |
| 18 } |
| 19 |
14 ThreadedChannel::ThreadedChannel(ProxyMain* proxy_main, | 20 ThreadedChannel::ThreadedChannel(ProxyMain* proxy_main, |
15 TaskRunnerProvider* task_runner_provider) | 21 TaskRunnerProvider* task_runner_provider) |
16 : task_runner_provider_(task_runner_provider), | 22 : task_runner_provider_(task_runner_provider), |
17 main_thread_only_vars_unsafe_(proxy_main), | 23 main_thread_only_vars_unsafe_(proxy_main), |
18 compositor_thread_vars_unsafe_( | 24 compositor_thread_vars_unsafe_( |
19 main() | 25 main() |
20 .proxy_main_weak_factory.GetWeakPtr()) { | 26 .proxy_main_weak_factory.GetWeakPtr()) { |
21 DCHECK(IsMainThread()); | 27 DCHECK(IsMainThread()); |
22 } | 28 } |
23 | 29 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 271 |
266 void ThreadedChannel::BeginMainFrame( | 272 void ThreadedChannel::BeginMainFrame( |
267 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 273 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
268 DCHECK(IsImplThread()); | 274 DCHECK(IsImplThread()); |
269 MainThreadTaskRunner()->PostTask( | 275 MainThreadTaskRunner()->PostTask( |
270 FROM_HERE, | 276 FROM_HERE, |
271 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, | 277 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, |
272 base::Passed(&begin_main_frame_state))); | 278 base::Passed(&begin_main_frame_state))); |
273 } | 279 } |
274 | 280 |
275 ProxyImpl* ThreadedChannel::GetProxyImplForTesting() const { | |
276 return impl().proxy_impl.get(); | |
277 } | |
278 | |
279 scoped_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( | 281 scoped_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( |
280 ChannelImpl* channel_impl, | 282 ChannelImpl* channel_impl, |
281 LayerTreeHost* layer_tree_host, | 283 LayerTreeHost* layer_tree_host, |
282 TaskRunnerProvider* task_runner_provider, | 284 TaskRunnerProvider* task_runner_provider, |
283 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 285 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
284 DCHECK(IsImplThread()); | 286 DCHECK(IsImplThread()); |
285 return ProxyImpl::Create(channel_impl, layer_tree_host, task_runner_provider, | 287 return ProxyImpl::Create(channel_impl, layer_tree_host, task_runner_provider, |
286 std::move(external_begin_frame_source)); | 288 std::move(external_begin_frame_source)); |
287 } | 289 } |
288 | 290 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 : proxy_main_weak_factory(proxy_main), initialized(false) {} | 357 : proxy_main_weak_factory(proxy_main), initialized(false) {} |
356 | 358 |
357 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} | 359 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} |
358 | 360 |
359 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( | 361 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( |
360 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) | 362 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) |
361 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} | 363 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} |
362 | 364 |
363 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} | 365 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} |
364 | 366 |
365 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( | |
366 ProxyMain* proxy_main, | |
367 TaskRunnerProvider* task_runner_provider) { | |
368 return make_scoped_ptr(new ThreadedChannel(proxy_main, task_runner_provider)); | |
369 } | |
370 | |
371 } // namespace cc | 367 } // namespace cc |
OLD | NEW |