| 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 bool* main_frame_will_happen) { | 128 bool* main_frame_will_happen) { |
| 129 DCHECK(IsMainThread()); | 129 DCHECK(IsMainThread()); |
| 130 ImplThreadTaskRunner()->PostTask( | 130 ImplThreadTaskRunner()->PostTask( |
| 131 FROM_HERE, | 131 FROM_HERE, |
| 132 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, | 132 base::Bind(&ProxyImpl::MainFrameWillHappenOnImplForTesting, |
| 133 proxy_impl_weak_ptr_, completion, main_frame_will_happen)); | 133 proxy_impl_weak_ptr_, completion, main_frame_will_happen)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ThreadedChannel::NotifyReadyToCommitOnImpl( | 136 void ThreadedChannel::NotifyReadyToCommitOnImpl( |
| 137 CompletionEvent* completion, | 137 CompletionEvent* completion, |
| 138 LayerTreeHost* layer_tree_host, | 138 LayerTreeHostInProcess* layer_tree_host, |
| 139 base::TimeTicks main_thread_start_time, | 139 base::TimeTicks main_thread_start_time, |
| 140 bool hold_commit_for_activation) { | 140 bool hold_commit_for_activation) { |
| 141 DCHECK(IsMainThread()); | 141 DCHECK(IsMainThread()); |
| 142 ImplThreadTaskRunner()->PostTask( | 142 ImplThreadTaskRunner()->PostTask( |
| 143 FROM_HERE, | 143 FROM_HERE, |
| 144 base::Bind(&ProxyImpl::NotifyReadyToCommitOnImpl, proxy_impl_weak_ptr_, | 144 base::Bind(&ProxyImpl::NotifyReadyToCommitOnImpl, proxy_impl_weak_ptr_, |
| 145 completion, layer_tree_host, main_thread_start_time, | 145 completion, layer_tree_host, main_thread_start_time, |
| 146 hold_commit_for_activation)); | 146 hold_commit_for_activation)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ThreadedChannel::SynchronouslyInitializeImpl( | 149 void ThreadedChannel::SynchronouslyInitializeImpl( |
| 150 LayerTreeHost* layer_tree_host, | 150 LayerTreeHostInProcess* layer_tree_host, |
| 151 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 151 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 152 TRACE_EVENT0("cc", "ThreadChannel::SynchronouslyInitializeImpl"); | 152 TRACE_EVENT0("cc", "ThreadChannel::SynchronouslyInitializeImpl"); |
| 153 DCHECK(IsMainThread()); | 153 DCHECK(IsMainThread()); |
| 154 { | 154 { |
| 155 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 155 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
| 156 CompletionEvent completion; | 156 CompletionEvent completion; |
| 157 ImplThreadTaskRunner()->PostTask( | 157 ImplThreadTaskRunner()->PostTask( |
| 158 FROM_HERE, | 158 FROM_HERE, |
| 159 base::Bind(&ThreadedChannel::InitializeImplOnImpl, | 159 base::Bind(&ThreadedChannel::InitializeImplOnImpl, |
| 160 base::Unretained(this), &completion, layer_tree_host, | 160 base::Unretained(this), &completion, layer_tree_host, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 253 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
| 254 DCHECK(IsImplThread()); | 254 DCHECK(IsImplThread()); |
| 255 MainThreadTaskRunner()->PostTask( | 255 MainThreadTaskRunner()->PostTask( |
| 256 FROM_HERE, | 256 FROM_HERE, |
| 257 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, | 257 base::Bind(&ProxyMain::BeginMainFrame, impl().proxy_main_weak_ptr, |
| 258 base::Passed(&begin_main_frame_state))); | 258 base::Passed(&begin_main_frame_state))); |
| 259 } | 259 } |
| 260 | 260 |
| 261 std::unique_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( | 261 std::unique_ptr<ProxyImpl> ThreadedChannel::CreateProxyImpl( |
| 262 ChannelImpl* channel_impl, | 262 ChannelImpl* channel_impl, |
| 263 LayerTreeHost* layer_tree_host, | 263 LayerTreeHostInProcess* layer_tree_host, |
| 264 TaskRunnerProvider* task_runner_provider, | 264 TaskRunnerProvider* task_runner_provider, |
| 265 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 265 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 266 DCHECK(IsImplThread()); | 266 DCHECK(IsImplThread()); |
| 267 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, | 267 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, |
| 268 task_runner_provider, | 268 task_runner_provider, |
| 269 std::move(external_begin_frame_source)); | 269 std::move(external_begin_frame_source)); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ThreadedChannel::InitializeImplOnImpl( | 272 void ThreadedChannel::InitializeImplOnImpl( |
| 273 CompletionEvent* completion, | 273 CompletionEvent* completion, |
| 274 LayerTreeHost* layer_tree_host, | 274 LayerTreeHostInProcess* layer_tree_host, |
| 275 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 275 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
| 276 DCHECK(IsImplThread()); | 276 DCHECK(IsImplThread()); |
| 277 impl().proxy_impl = | 277 impl().proxy_impl = |
| 278 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, | 278 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, |
| 279 std::move(external_begin_frame_source)); | 279 std::move(external_begin_frame_source)); |
| 280 impl().proxy_impl_weak_factory = | 280 impl().proxy_impl_weak_factory = |
| 281 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>( | 281 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>( |
| 282 impl().proxy_impl.get()); | 282 impl().proxy_impl.get()); |
| 283 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); | 283 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); |
| 284 completion->Signal(); | 284 completion->Signal(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} | 341 ThreadedChannel::MainThreadOnly::~MainThreadOnly() {} |
| 342 | 342 |
| 343 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( | 343 ThreadedChannel::CompositorThreadOnly::CompositorThreadOnly( |
| 344 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) | 344 base::WeakPtr<ProxyMain> proxy_main_weak_ptr) |
| 345 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} | 345 : proxy_main_weak_ptr(proxy_main_weak_ptr) {} |
| 346 | 346 |
| 347 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} | 347 ThreadedChannel::CompositorThreadOnly::~CompositorThreadOnly() {} |
| 348 | 348 |
| 349 } // namespace cc | 349 } // namespace cc |
| OLD | NEW |