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..670a350ac856ba06a94057dbf1b5c6225f100616 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(); |
+ (void)layer_tree_host_impl_->PrepareToDraw(frame); |
danakj
2014/08/20 18:22:10
don't need (void) here
dneto
2014/08/20 19:15:20
Acknowledged.
|
+ 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; |
} |