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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2317493003: cc: Toward merging DrawFrame and SwapBuffers in DelegatingRenderer. (Closed)
Patch Set: merge-draw-swap Created 4 years, 3 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 f46d3cddfba829d2c71428b1f699eddaea703af4..deea1fcc5e0279e5e1f058217772d503f87eb1c2 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1723,24 +1723,6 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame) {
renderer_->DrawFrame(&frame->render_passes);
// The render passes should be consumed by the renderer.
DCHECK(frame->render_passes.empty());
-
- // The next frame should start by assuming nothing has changed, and changes
- // are noted as they occur.
- // TODO(boliu): If we did a temporary software renderer frame, propogate the
- // damage forward to the next frame.
- for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) {
- (*frame->render_surface_layer_list)[i]
- ->render_surface()
- ->damage_tracker()
- ->DidDrawDamagedArea();
- }
- active_tree_->ResetAllChangeTracking();
-
- active_tree_->set_has_ever_been_drawn(true);
- devtools_instrumentation::DidDrawFrame(id_);
- benchmark_instrumentation::IssueImplThreadRenderingStatsEvent(
- rendering_stats_instrumentation_->impl_thread_rendering_stats());
- rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats();
}
void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) {
@@ -1881,10 +1863,12 @@ void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() {
bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
ResetRequiresHighResToDraw();
+
if (frame.has_no_damage) {
active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS);
return false;
}
+
CompositorFrameMetadata metadata = MakeCompositorFrameMetadata();
metadata.may_contain_video = frame.may_contain_video;
active_tree()->FinishSwapPromises(&metadata);
@@ -1902,6 +1886,22 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
}
}
renderer_->SwapBuffers(std::move(metadata));
+
+ // The next frame should start by assuming nothing has changed, and changes
+ // are noted as they occur.
+ // TODO(boliu): If we did a temporary software renderer frame, propogate the
+ // damage forward to the next frame.
+ for (size_t i = 0; i < frame.render_surface_layer_list->size(); i++) {
+ auto* surface = (*frame.render_surface_layer_list)[i]->render_surface();
+ surface->damage_tracker()->DidDrawDamagedArea();
+ }
+ active_tree_->ResetAllChangeTracking();
+
+ active_tree_->set_has_ever_been_drawn(true);
+ devtools_instrumentation::DidDrawFrame(id_);
+ benchmark_instrumentation::IssueImplThreadRenderingStatsEvent(
+ rendering_stats_instrumentation_->impl_thread_rendering_stats());
+ rendering_stats_instrumentation_->AccumulateAndClearImplThreadStats();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698