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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 14060015: cc: Async readback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 8 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/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index cb53f79fbe117bc7a5da8be196ced524ef31d472..5a0015ef8925706226bea7580b1db9de91a93c97 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -577,6 +577,9 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
// due to an impl-animation, we drop the frame to avoid flashing due to the
// texture suddenly appearing in the future.
bool draw_frame = true;
+ // When we have a copy request for a layer, we need to draw no matter
+ // what, as the layer may disappear after this frame.
+ bool have_copy_request = false;
int layers_drawn = 0;
@@ -595,7 +598,12 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
AppendQuadsData append_quads_data(target_render_pass->id);
- if (it.represents_contributing_render_surface()) {
+ if (it.represents_target_render_surface()) {
+ if (it->HasRequestCopyCallback()) {
+ have_copy_request = true;
+ it->TakeRequestCopyCallbacks(&target_render_pass->copy_callbacks);
+ }
+ } else if (it.represents_contributing_render_surface()) {
RenderPass::Id contributing_render_pass_id =
it->render_surface()->RenderPassId();
RenderPass* contributing_render_pass =
@@ -671,6 +679,9 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
occlusion_tracker.LeaveLayer(it);
}
+ if (have_copy_request)
+ draw_frame = true;
+
rendering_stats_instrumentation_->AddLayersDrawn(layers_drawn);
#ifndef NDEBUG
@@ -693,6 +704,8 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
if (draw_frame)
occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
+ else
+ DCHECK(!have_copy_request);
RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame);
renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes);

Powered by Google App Engine
This is Rietveld 408576698