| 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/animation/animation_events.h" | 10 #include "cc/animation/animation_events.h" |
| 11 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 scoped_ptr<ThreadedChannel> ThreadedChannel::Create( |
| 16 ProxyMain* proxy_main, |
| 17 TaskRunnerProvider* task_runner_provider) { |
| 18 return make_scoped_ptr(new ThreadedChannel(proxy_main, task_runner_provider)); |
| 19 } |
| 20 |
| 15 ThreadedChannel::ThreadedChannel(ProxyMain* proxy_main, | 21 ThreadedChannel::ThreadedChannel(ProxyMain* proxy_main, |
| 16 TaskRunnerProvider* task_runner_provider) | 22 TaskRunnerProvider* task_runner_provider) |
| 17 : task_runner_provider_(task_runner_provider), | 23 : task_runner_provider_(task_runner_provider), |
| 18 main_thread_only_vars_unsafe_(proxy_main), | 24 main_thread_only_vars_unsafe_(proxy_main), |
| 19 compositor_thread_vars_unsafe_( | 25 compositor_thread_vars_unsafe_( |
| 20 main() | 26 main() |
| 21 .proxy_main_weak_factory.GetWeakPtr()) { | 27 .proxy_main_weak_factory.GetWeakPtr()) { |
| 22 DCHECK(IsMainThread()); | 28 DCHECK(IsMainThread()); |
| 23 } | 29 } |
| 24 | 30 |
| (...skipping 240 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 |