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

Unified Diff: cc/trees/thread_proxy.cc

Issue 131683005: cc: Make PrepareToDraw return an enum for why it aborts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 0b7d7ef9ebe1519c734d49005591378d4359841f..b5f455556cf7b01c807ed45537e04d76fd1ae6ae 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -1088,17 +1088,21 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
bool readback_requested) {
TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap");
DrawSwapReadbackResult result;
- result.did_draw = false;
result.did_swap = false;
result.did_readback = false;
+
DCHECK(IsImplThread());
DCHECK(layer_tree_host_impl_.get());
- if (!layer_tree_host_impl_)
+ if (!layer_tree_host_impl_) {
+ result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_NO_TREE;
return result;
+ }
DCHECK(layer_tree_host_impl_->renderer());
- if (!layer_tree_host_impl_->renderer())
+ if (!layer_tree_host_impl_->renderer()) {
+ result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_NO_RENDERER;
return result;
+ }
base::TimeTicks start_time = base::TimeTicks::HighResNow();
base::TimeDelta draw_duration_estimate = DrawDurationEstimate();
@@ -1139,16 +1143,19 @@ DrawSwapReadbackResult ThreadProxy::DrawSwapReadbackInternal(
if (drawing_for_readback)
readback_rect = readback_request_on_impl_thread_->rect;
- if (layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect) ||
- forced_draw)
- draw_frame = true;
+ result.draw_result =
+ layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect);
brianderson 2014/01/29 01:31:22 It feels funny to have PrepareToDraw return DID_DR
enne (OOO) 2014/01/29 01:40:19 Yeah, I thought that too. I could change DID_DRAW
danakj 2014/01/29 01:42:35 WILL_DRAW?
enne (OOO) 2014/01/29 01:47:20 WILL_DRAW doesn't make sense as a result after Dra
+ draw_frame =
+ forced_draw || result.draw_result == DrawSwapReadbackResult::DID_DRAW;
}
if (draw_frame) {
layer_tree_host_impl_->DrawLayers(
&frame,
scheduler_on_impl_thread_->LastBeginImplFrameTime());
- result.did_draw = true;
+ result.draw_result = DrawSwapReadbackResult::DID_DRAW;
+ } else {
+ DCHECK_NE(DrawSwapReadbackResult::DID_DRAW, result.draw_result);
}
layer_tree_host_impl_->DidDrawAllLayers(frame);

Powered by Google App Engine
This is Rietveld 408576698