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

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

Issue 1831083002: cc: Force a redraw on initializing a new output surface for remote compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed updating the test. Created 4 years, 9 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
« no previous file with comments | « cc/trees/remote_channel_impl.h ('k') | cc/trees/remote_channel_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "cc/animation/animation_events.h" 9 #include "cc/animation/animation_events.h"
10 #include "cc/proto/compositor_message.pb.h" 10 #include "cc/proto/compositor_message.pb.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ImplThreadTaskRunner()->PostTask( 132 ImplThreadTaskRunner()->PostTask(
133 FROM_HERE, 133 FROM_HERE,
134 base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl, 134 base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl,
135 proxy_impl_weak_ptr_, reason, main_thread_start_time)); 135 proxy_impl_weak_ptr_, reason, main_thread_start_time));
136 } break; 136 } break;
137 case proto::CompositorMessageToImpl::SET_NEEDS_REDRAW: { 137 case proto::CompositorMessageToImpl::SET_NEEDS_REDRAW: {
138 const proto::SetNeedsRedraw& set_needs_redraw_message = 138 const proto::SetNeedsRedraw& set_needs_redraw_message =
139 proto.set_needs_redraw_message(); 139 proto.set_needs_redraw_message();
140 gfx::Rect damaged_rect = 140 gfx::Rect damaged_rect =
141 ProtoToRect(set_needs_redraw_message.damaged_rect()); 141 ProtoToRect(set_needs_redraw_message.damaged_rect());
142 ImplThreadTaskRunner()->PostTask( 142 PostSetNeedsRedrawToImpl(damaged_rect);
143 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl,
144 proxy_impl_weak_ptr_, damaged_rect));
145 } break; 143 } break;
146 } 144 }
147 } 145 }
148 146
149 void RemoteChannelImpl::FinishAllRendering() { 147 void RemoteChannelImpl::FinishAllRendering() {
150 NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; 148 NOTREACHED() << "Should not be called on the remote client LayerTreeHost";
151 } 149 }
152 150
153 bool RemoteChannelImpl::IsStarted() const { 151 bool RemoteChannelImpl::IsStarted() const {
154 DCHECK(task_runner_provider_->IsMainThread()); 152 DCHECK(task_runner_provider_->IsMainThread());
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 main().layer_tree_host->DidInitializeOutputSurface(); 419 main().layer_tree_host->DidInitializeOutputSurface();
422 420
423 // If we were waiting for output surface initialization, we might have queued 421 // If we were waiting for output surface initialization, we might have queued
424 // some messages. Relay them now that a new output surface has been 422 // some messages. Relay them now that a new output surface has been
425 // initialized. 423 // initialized.
426 main().waiting_for_output_surface_initialization = false; 424 main().waiting_for_output_surface_initialization = false;
427 while (!main().pending_messages.empty()) { 425 while (!main().pending_messages.empty()) {
428 HandleProto(main().pending_messages.front()); 426 HandleProto(main().pending_messages.front());
429 main().pending_messages.pop(); 427 main().pending_messages.pop();
430 } 428 }
429
430 // The commit after a new output surface can early out, in which case we will
431 // never redraw. Schedule one just to be safe.
432 PostSetNeedsRedrawToImpl(
433 gfx::Rect(main().layer_tree_host->device_viewport_size()));
431 } 434 }
432 435
433 void RemoteChannelImpl::SendMessageProtoOnMain( 436 void RemoteChannelImpl::SendMessageProtoOnMain(
434 scoped_ptr<proto::CompositorMessage> proto) { 437 scoped_ptr<proto::CompositorMessage> proto) {
435 DCHECK(task_runner_provider_->IsMainThread()); 438 DCHECK(task_runner_provider_->IsMainThread());
436 439
437 main().remote_proto_channel->SendCompositorProto(*proto); 440 main().remote_proto_channel->SendCompositorProto(*proto);
438 } 441 }
439 442
443 void RemoteChannelImpl::PostSetNeedsRedrawToImpl(
444 const gfx::Rect& damaged_rect) {
445 DCHECK(task_runner_provider_->IsMainThread());
446
447 ImplThreadTaskRunner()->PostTask(
448 FROM_HERE, base::Bind(&ProxyImpl::SetNeedsRedrawOnImpl,
449 proxy_impl_weak_ptr_, damaged_rect));
450 }
451
440 void RemoteChannelImpl::InitializeImplOnImpl(CompletionEvent* completion, 452 void RemoteChannelImpl::InitializeImplOnImpl(CompletionEvent* completion,
441 LayerTreeHost* layer_tree_host) { 453 LayerTreeHost* layer_tree_host) {
442 DCHECK(task_runner_provider_->IsMainThreadBlocked()); 454 DCHECK(task_runner_provider_->IsMainThreadBlocked());
443 DCHECK(task_runner_provider_->IsImplThread()); 455 DCHECK(task_runner_provider_->IsImplThread());
444 456
445 impl().proxy_impl = 457 impl().proxy_impl =
446 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, nullptr); 458 CreateProxyImpl(this, layer_tree_host, task_runner_provider_, nullptr);
447 impl().proxy_impl_weak_factory = make_scoped_ptr( 459 impl().proxy_impl_weak_factory = make_scoped_ptr(
448 new base::WeakPtrFactory<ProxyImpl>(impl().proxy_impl.get())); 460 new base::WeakPtrFactory<ProxyImpl>(impl().proxy_impl.get()));
449 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr(); 461 proxy_impl_weak_ptr_ = impl().proxy_impl_weak_factory->GetWeakPtr();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 520
509 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly( 521 RemoteChannelImpl::CompositorThreadOnly::CompositorThreadOnly(
510 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr) 522 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr)
511 : proxy_impl(nullptr), 523 : proxy_impl(nullptr),
512 proxy_impl_weak_factory(nullptr), 524 proxy_impl_weak_factory(nullptr),
513 remote_channel_weak_ptr(remote_channel_weak_ptr) {} 525 remote_channel_weak_ptr(remote_channel_weak_ptr) {}
514 526
515 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {} 527 RemoteChannelImpl::CompositorThreadOnly::~CompositorThreadOnly() {}
516 528
517 } // namespace cc 529 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/remote_channel_impl.h ('k') | cc/trees/remote_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698