| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( | 132 void ThreadedChannel::MainFrameWillHappenOnImplForTesting( |
| 133 CompletionEvent* completion, | 133 CompletionEvent* completion, |
| 134 bool* main_frame_will_happen) { | 134 bool* main_frame_will_happen) { |
| 135 DCHECK(IsMainThread()); | 135 DCHECK(IsMainThread()); |
| 136 ImplThreadTaskRunner()->PostTask( | 136 ImplThreadTaskRunner()->PostTask( |
| 137 FROM_HERE, | 137 FROM_HERE, |
| 138 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, | 138 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, |
| 139 proxy_impl_weak_ptr_, completion, main_frame_will_happen)); | 139 proxy_impl_weak_ptr_, completion, main_frame_will_happen)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ThreadedChannel::StartCommitOnImpl(CompletionEvent* completion, | 142 void ThreadedChannel::NotifyReadyToCommitOnImpl( |
| 143 LayerTreeHost* layer_tree_host, | 143 CompletionEvent* completion, |
| 144 base::TimeTicks main_thread_start_time, | 144 LayerTreeHost* layer_tree_host, |
| 145 bool hold_commit_for_activation) { | 145 base::TimeTicks main_thread_start_time, |
| 146 bool hold_commit_for_activation) { |
| 146 DCHECK(IsMainThread()); | 147 DCHECK(IsMainThread()); |
| 147 ImplThreadTaskRunner()->PostTask( | 148 ImplThreadTaskRunner()->PostTask( |
| 148 FROM_HERE, base::Bind(&ProxyImpl::StartCommitOnImpl, proxy_impl_weak_ptr_, | 149 FROM_HERE, |
| 149 completion, layer_tree_host, main_thread_start_time, | 150 base::Bind(&ProxyImpl::NotifyReadyToCommitOnImpl, proxy_impl_weak_ptr_, |
| 150 hold_commit_for_activation)); | 151 completion, layer_tree_host, main_thread_start_time, |
| 152 hold_commit_for_activation)); |
| 151 } | 153 } |
| 152 | 154 |
| 153 void ThreadedChannel::SynchronouslyInitializeImpl( | 155 void ThreadedChannel::SynchronouslyInitializeImpl( |
| 154 LayerTreeHost* layer_tree_host, | 156 LayerTreeHost* layer_tree_host, |
| 155 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 157 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 156 TRACE_EVENT0("cc", "ThreadChannel::SynchronouslyInitializeImpl"); | 158 TRACE_EVENT0("cc", "ThreadChannel::SynchronouslyInitializeImpl"); |
| 157 DCHECK(IsMainThread()); | 159 DCHECK(IsMainThread()); |
| 158 { | 160 { |
| 159 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 161 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
| 160 CompletionEvent completion; | 162 CompletionEvent completion; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, | 273 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, |
| 272 base::Passed(&begin_main_frame_state))); | 274 base::Passed(&begin_main_frame_state))); |
| 273 } | 275 } |
| 274 | 276 |
| 275 std::unique_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( | 277 std::unique_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( |
| 276 ChannelImpl* channel_impl, | 278 ChannelImpl* channel_impl, |
| 277 LayerTreeHost* layer_tree_host, | 279 LayerTreeHost* layer_tree_host, |
| 278 TaskRunnerProvider* task_runner_provider, | 280 TaskRunnerProvider* task_runner_provider, |
| 279 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 281 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 280 DCHECK(IsImplThread()); | 282 DCHECK(IsImplThread()); |
| 281 return ProxyImpl::Create(channel_impl, layer_tree_host, task_runner_provider, | 283 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, |
| 282 std::move(external_begin_frame_source)); | 284 task_runner_provider, |
| 285 std::move(external_begin_frame_source)); |
| 283 } | 286 } |
| 284 | 287 |
| 285 void ThreadedChannel::InitializeImplOnImpl( | 288 void ThreadedChannel::InitializeImplOnImpl( |
| 286 CompletionEvent* completion, | 289 CompletionEvent* completion, |
| 287 LayerTreeHost* layer_tree_host, | 290 LayerTreeHost* layer_tree_host, |
| 288 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 291 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 289 DCHECK(IsImplThread()); | 292 DCHECK(IsImplThread()); |
| 290 impl().proxy_impl = | 293 impl().proxy_impl = |
| 291 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, | 294 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, |
| 292 std::move(external_begin_frame_source)); | 295 std::move(external_begin_frame_source)); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 355 |
| 353 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} | 356 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} |
| 354 | 357 |
| 355 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( | 358 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( |
| 356 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) | 359 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) |
| 357 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} | 360 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} |
| 358 | 361 |
| 359 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} | 362 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} |
| 360 | 363 |
| 361 } // namespace cc | 364 } // namespace cc |
| OLD | NEW |