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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: Fix style: bracing, no (void) Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index ab7757966d15c0bc8824a1a3b5d5847ecec56b02..418d42ee1c8df7e8180b568ac8948cd55cca4210 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -37,7 +37,8 @@ SingleThreadProxy::SingleThreadProxy(
layer_tree_host_(layer_tree_host),
client_(client),
next_frame_is_newly_committed_frame_(false),
- inside_draw_(false) {
+ inside_draw_(false),
+ weak_factory_(this) {
TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
DCHECK(Proxy::IsMainThread());
DCHECK(layer_tree_host);
@@ -316,6 +317,18 @@ void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
// Cause a commit so we can notice the lost context.
SetNeedsCommitOnImplThread();
client_->DidAbortSwapBuffers();
+ Proxy::MainThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&SingleThreadProxy::DidLoseOutputSurface,
+ weak_factory_.GetWeakPtr()));
+}
+
+void SingleThreadProxy::DidLoseOutputSurface() {
+ DCHECK(Proxy::IsMainThread());
+ TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurface");
+
+ // The layer tree host will in turn schedule another commit.
+ layer_tree_host_->DidLoseOutputSurface();
}
void SingleThreadProxy::DidSwapBuffersOnImplThread() {
@@ -415,7 +428,6 @@ bool SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite");
DCHECK(!layer_tree_host_->output_surface_lost());
- bool lost_output_surface = false;
{
DebugScopedSetImplThread impl(this);
base::AutoReset<bool> mark_inside(&inside_draw_, true);
@@ -433,12 +445,9 @@ bool SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
UpdateBackgroundAnimateTicking();
- if (!layer_tree_host_impl_->IsContextLost()) {
- layer_tree_host_impl_->PrepareToDraw(frame);
- layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
- layer_tree_host_impl_->DidDrawAllLayers(*frame);
- }
- lost_output_surface = layer_tree_host_impl_->IsContextLost();
+ layer_tree_host_impl_->PrepareToDraw(frame);
+ layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
+ layer_tree_host_impl_->DidDrawAllLayers(*frame);
bool start_ready_animations = true;
layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
@@ -446,11 +455,6 @@ bool SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
}
- if (lost_output_surface) {
- layer_tree_host_->DidLoseOutputSurface();
- return false;
- }
-
return true;
}
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698