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