Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: cc/trees/remote_channel_impl.cc

Issue 2340143002: cc: Rename LayerTreeHost to LayerTreeHostInProcess. (Closed)
Patch Set: tests + comment updates Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "cc/proto/compositor_message.pb.h" 11 #include "cc/proto/compositor_message.pb.h"
12 #include "cc/proto/compositor_message_to_impl.pb.h" 12 #include "cc/proto/compositor_message_to_impl.pb.h"
13 #include "cc/proto/compositor_message_to_main.pb.h" 13 #include "cc/proto/compositor_message_to_main.pb.h"
14 #include "cc/proto/gfx_conversions.h" 14 #include "cc/proto/gfx_conversions.h"
15 #include "cc/trees/layer_tree_host.h" 15 #include "cc/trees/layer_tree_host_in_process.h"
16 #include "cc/trees/layer_tree_settings.h" 16 #include "cc/trees/layer_tree_settings.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 RemoteChannelImpl::RemoteChannelImpl(LayerTreeHost* layer_tree_host, 20 RemoteChannelImpl::RemoteChannelImpl(LayerTreeHostInProcess* layer_tree_host,
21 RemoteProtoChannel* remote_proto_channel, 21 RemoteProtoChannel* remote_proto_channel,
22 TaskRunnerProvider* task_runner_provider) 22 TaskRunnerProvider* task_runner_provider)
23 : task_runner_provider_(task_runner_provider), 23 : task_runner_provider_(task_runner_provider),
24 main_thread_vars_unsafe_(this, layer_tree_host, remote_proto_channel), 24 main_thread_vars_unsafe_(this, layer_tree_host, remote_proto_channel),
25 compositor_thread_vars_unsafe_( 25 compositor_thread_vars_unsafe_(
26 main().remote_channel_weak_factory.GetWeakPtr()) { 26 main().remote_channel_weak_factory.GetWeakPtr()) {
27 DCHECK(task_runner_provider_->IsMainThread()); 27 DCHECK(task_runner_provider_->IsMainThread());
28 28
29 main().remote_proto_channel->SetProtoReceiver(this); 29 main().remote_proto_channel->SetProtoReceiver(this);
30 } 30 }
31 31
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 LayerTreeHost* 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) { 43 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
44 DCHECK(task_runner_provider_->IsImplThread()); 44 DCHECK(task_runner_provider_->IsImplThread());
45 DCHECK(!external_begin_frame_source); 45 DCHECK(!external_begin_frame_source);
46 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host, 46 return base::MakeUnique<ProxyImpl>(channel_impl, layer_tree_host,
47 task_runner_provider, 47 task_runner_provider,
48 std::move(external_begin_frame_source)); 48 std::move(external_begin_frame_source));
49 } 49 }
50 50
51 void RemoteChannelImpl::OnProtoReceived( 51 void RemoteChannelImpl::OnProtoReceived(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 void RemoteChannelImpl::SetNeedsAnimate() { 184 void RemoteChannelImpl::SetNeedsAnimate() {
185 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; 185 NOTREACHED() << "Should not be called on the remote client LayerTreeHost";
186 } 186 }
187 187
188 void RemoteChannelImpl::SetNeedsUpdateLayers() { 188 void RemoteChannelImpl::SetNeedsUpdateLayers() {
189 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; 189 NOTREACHED() << "Should not be called on the remote client LayerTreeHost";
190 } 190 }
191 191
192 void RemoteChannelImpl::SetNeedsCommit() { 192 void RemoteChannelImpl::SetNeedsCommit() {
193 // Ideally commits should be requested only on the server. But we have to 193 // Ideally commits should be requested only on the server. But we have to
194 // allow this call since the LayerTreeHost will currently ask for a commit in 194 // allow this call since the LayerTreeHostInProcesswill currently ask for a
195 // 2 cases: 195 // commit in 2 cases:
196 // 1) When it is being initialized from a protobuf for a commit. 196 // 1) When it is being initialized from a protobuf for a commit.
197 // 2) When it loses the output surface. 197 // 2) When it loses the output surface.
198 NOTIMPLEMENTED() << "Commits should not be requested on the client"; 198 NOTIMPLEMENTED() << "Commits should not be requested on the client";
199 } 199 }
200 200
201 void RemoteChannelImpl::SetNeedsRedraw(const gfx::Rect& damage_rect) { 201 void RemoteChannelImpl::SetNeedsRedraw(const gfx::Rect& damage_rect) {
202 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; 202 NOTREACHED() << "Should not be called on the remote client LayerTreeHost";
203 } 203 }
204 204
205 void RemoteChannelImpl::SetNextCommitWaitsForActivation() { 205 void RemoteChannelImpl::SetNextCommitWaitsForActivation() {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 void RemoteChannelImpl::PostSetNeedsRedrawToImpl( 432 void RemoteChannelImpl::PostSetNeedsRedrawToImpl(
433 const gfx::Rect& damaged_rect) { 433 const gfx::Rect& damaged_rect) {
434 DCHECK(task_runner_provider_->IsMainThread()); 434 DCHECK(task_runner_provider_->IsMainThread());
435 435
436 ImplThreadTaskRunner()->PostTask( 436 ImplThreadTaskRunner()->PostTask(
437 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl, 437 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl,
438 proxy_impl_weak_ptr_, damaged_rect)); 438 proxy_impl_weak_ptr_, damaged_rect));
439 } 439 }
440 440
441 void RemoteChannelImpl::InitializeImplOnImpl(CompletionEvent* completion, 441 void RemoteChannelImpl::InitializeImplOnImpl(
442 LayerTreeHost* layer_tree_host) { 442 CompletionEvent* completion,
443 LayerTreeHostInProcess* layer_tree_host) {
443 DCHECK(task_runner_provider_->IsMainThreadBlocked()); 444 DCHECK(task_runner_provider_->IsMainThreadBlocked());
444 DCHECK(task_runner_provider_->IsImplThread()); 445 DCHECK(task_runner_provider_->IsImplThread());
445 446
446 impl().proxy_impl = 447 impl().proxy_impl =
447 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, nullptr); 448 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, nullptr);
448 impl().proxy_impl_weak_factory = 449 impl().proxy_impl_weak_factory =
449 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>( 450 base::MakeUnique<base::WeakPtrFactory<ProxyImpl>>(
450 impl().proxy_impl.get()); 451 impl().proxy_impl.get());
451 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); 452 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr();
452 completion->Signal(); 453 completion->Signal();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 base::SingleThreadTaskRunner* RemoteChannelImpl::MainThreadTaskRunner() const { 489 base::SingleThreadTaskRunner* RemoteChannelImpl::MainThreadTaskRunner() const {
489 return task_runner_provider_->MainThreadTaskRunner(); 490 return task_runner_provider_->MainThreadTaskRunner();
490 } 491 }
491 492
492 base::SingleThreadTaskRunner* RemoteChannelImpl::ImplThreadTaskRunner() const { 493 base::SingleThreadTaskRunner* RemoteChannelImpl::ImplThreadTaskRunner() const {
493 return task_runner_provider_->ImplThreadTaskRunner(); 494 return task_runner_provider_->ImplThreadTaskRunner();
494 } 495 }
495 496
496 RemoteChannelImpl::MainThreadOnly::MainThreadOnly( 497 RemoteChannelImpl::MainThreadOnly::MainThreadOnly(
497 RemoteChannelImpl* remote_channel_impl, 498 RemoteChannelImpl* remote_channel_impl,
498 LayerTreeHost* layer_tree_host, 499 LayerTreeHostInProcess* layer_tree_host,
499 RemoteProtoChannel* remote_proto_channel) 500 RemoteProtoChannel* remote_proto_channel)
500 : layer_tree_host(layer_tree_host), 501 : layer_tree_host(layer_tree_host),
501 remote_proto_channel(remote_proto_channel), 502 remote_proto_channel(remote_proto_channel),
502 started(false), 503 started(false),
503 waiting_for_output_surface_initialization(false), 504 waiting_for_output_surface_initialization(false),
504 remote_channel_weak_factory(remote_channel_impl) { 505 remote_channel_weak_factory(remote_channel_impl) {
505 DCHECK(layer_tree_host); 506 DCHECK(layer_tree_host);
506 DCHECK(remote_proto_channel); 507 DCHECK(remote_proto_channel);
507 } 508 }
508 509
509 RemoteChannelImpl::MainThreadOnly::~MainThreadOnly() {} 510 RemoteChannelImpl::MainThreadOnly::~MainThreadOnly() {}
510 511
511 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( 512 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly(
512 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) 513 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr)
513 : proxy_impl(nullptr), 514 : proxy_impl(nullptr),
514 proxy_impl_weak_factory(nullptr), 515 proxy_impl_weak_factory(nullptr),
515 remote_channel_weak_ptr(remote_channel_weak_ptr) {} 516 remote_channel_weak_ptr(remote_channel_weak_ptr) {}
516 517
517 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} 518 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {}
518 519
519 } // namespace cc 520 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698