OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/remote_channel_impl.h" | 5 #include "cc/trees/remote_channel_impl.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.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 "cc/animation/animation_events.h" | 10 #include "cc/animation/animation_events.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 RemoteChannelImpl::~RemoteChannelImpl() { | 32 RemoteChannelImpl::~RemoteChannelImpl() { |
33 DCHECK(task_runner_provider_->IsMainThread()); | 33 DCHECK(task_runner_provider_->IsMainThread()); |
34 DCHECK(!main().started); | 34 DCHECK(!main().started); |
35 | 35 |
36 main().remote_proto_channel->SetProtoReceiver(nullptr); | 36 main().remote_proto_channel->SetProtoReceiver(nullptr); |
37 } | 37 } |
38 | 38 |
39 std::unique_ptr<ProxyImpl> RemoteChannelImpl::CreateProxyImpl( | 39 std::unique_ptr<ProxyImpl> RemoteChannelImpl::CreateProxyImpl( |
40 ChannelImpl* channel_impl, | 40 ChannelImpl* channel_impl, |
41 LayerTreeHostInProcess* layer_tree_host, | 41 LayerTreeHostInProcess* layer_tree_host, |
42 TaskRunnerProvider* task_runner_provider, | 42 TaskRunnerProvider* task_runner_provider) { |
43 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | |
44 DCHECK(task_runner_provider_->IsImplThread()); | 43 DCHECK(task_runner_provider_->IsImplThread()); |
45 DCHECK(!external_begin_frame_source); | |
46 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, | 44 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, |
47 task_runner_provider, | 45 task_runner_provider); |
48 std::move(external_begin_frame_source)); | |
49 } | 46 } |
50 | 47 |
51 void RemoteChannelImpl::OnProtoReceived( | 48 void RemoteChannelImpl::OnProtoReceived( |
52 std::unique_ptr<proto::CompositorMessage> proto) { | 49 std::unique_ptr<proto::CompositorMessage> proto) { |
53 DCHECK(task_runner_provider_->IsMainThread()); | 50 DCHECK(task_runner_provider_->IsMainThread()); |
54 DCHECK(main().started); | 51 DCHECK(main().started); |
55 DCHECK(proto->has_to_impl()); | 52 DCHECK(proto->has_to_impl()); |
56 | 53 |
57 // If we don't have an CompositorFrameSink, queue the message and defer | 54 // If we don't have an CompositorFrameSink, queue the message and defer |
58 // processing it till we initialize a new CompositorFrameSink. | 55 // processing it till we initialize a new CompositorFrameSink. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 bool RemoteChannelImpl::CommitRequested() const { | 219 bool RemoteChannelImpl::CommitRequested() const { |
223 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; | 220 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; |
224 return false; | 221 return false; |
225 } | 222 } |
226 | 223 |
227 bool RemoteChannelImpl::BeginMainFrameRequested() const { | 224 bool RemoteChannelImpl::BeginMainFrameRequested() const { |
228 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; | 225 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; |
229 return false; | 226 return false; |
230 } | 227 } |
231 | 228 |
232 void RemoteChannelImpl::Start( | 229 void RemoteChannelImpl::Start() { |
233 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | |
234 DCHECK(task_runner_provider_->IsMainThread()); | 230 DCHECK(task_runner_provider_->IsMainThread()); |
235 DCHECK(!main().started); | 231 DCHECK(!main().started); |
236 DCHECK(!external_begin_frame_source); | |
237 | 232 |
238 CompletionEvent completion; | 233 CompletionEvent completion; |
239 { | 234 { |
240 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 235 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
241 ImplThreadTaskRunner()->PostTask( | 236 ImplThreadTaskRunner()->PostTask( |
242 FROM_HERE, base::Bind(&RemoteChannelImpl::InitializeImplOnImpl, | 237 FROM_HERE, base::Bind(&RemoteChannelImpl::InitializeImplOnImpl, |
243 base::Unretained(this), &completion, | 238 base::Unretained(this), &completion, |
244 main().layer_tree_host)); | 239 main().layer_tree_host)); |
245 completion.Wait(); | 240 completion.Wait(); |
246 } | 241 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 proxy_impl_weak_ptr_, damaged_rect)); | 436 proxy_impl_weak_ptr_, damaged_rect)); |
442 } | 437 } |
443 | 438 |
444 void RemoteChannelImpl::InitializeImplOnImpl( | 439 void RemoteChannelImpl::InitializeImplOnImpl( |
445 CompletionEvent* completion, | 440 CompletionEvent* completion, |
446 LayerTreeHostInProcess* layer_tree_host) { | 441 LayerTreeHostInProcess* layer_tree_host) { |
447 DCHECK(task_runner_provider_->IsMainThreadBlocked()); | 442 DCHECK(task_runner_provider_->IsMainThreadBlocked()); |
448 DCHECK(task_runner_provider_->IsImplThread()); | 443 DCHECK(task_runner_provider_->IsImplThread()); |
449 | 444 |
450 impl().proxy_impl = | 445 impl().proxy_impl = |
451 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, nullptr); | 446 CreateProxyImpl(this, layer_tree_host, task_runner_provider_); |
452 impl().proxy_impl_weak_factory = | 447 impl().proxy_impl_weak_factory = |
453 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>( | 448 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>( |
454 impl().proxy_impl.get()); | 449 impl().proxy_impl.get()); |
455 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); | 450 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); |
456 completion->Signal(); | 451 completion->Signal(); |
457 } | 452 } |
458 | 453 |
459 void RemoteChannelImpl::ShutdownImplOnImpl(CompletionEvent* completion) { | 454 void RemoteChannelImpl::ShutdownImplOnImpl(CompletionEvent* completion) { |
460 DCHECK(task_runner_provider_->IsMainThreadBlocked()); | 455 DCHECK(task_runner_provider_->IsMainThreadBlocked()); |
461 DCHECK(task_runner_provider_->IsImplThread()); | 456 DCHECK(task_runner_provider_->IsImplThread()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 509 |
515 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( | 510 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( |
516 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) | 511 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) |
517 : proxy_impl(nullptr), | 512 : proxy_impl(nullptr), |
518 proxy_impl_weak_factory(nullptr), | 513 proxy_impl_weak_factory(nullptr), |
519 remote_channel_weak_ptr(remote_channel_weak_ptr) {} | 514 remote_channel_weak_ptr(remote_channel_weak_ptr) {} |
520 | 515 |
521 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} | 516 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} |
522 | 517 |
523 } // namespace cc | 518 } // namespace cc |
OLD | NEW |