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

Unified Diff: cc/surfaces/surface.cc

Issue 2689563005: Surfaces: Receive resources only once (Closed)
Patch Set: Added a unit test Created 3 years, 10 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/surfaces/compositor_frame_sink_support_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface.cc
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index c2ab3541abca7fa12fb9dcfd0f0a18ac3ab28de1..cd95ac05c720aba8502a375ad05786cbe8955526 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -59,16 +59,16 @@ void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) {
UpdateBlockingSurfaces(previous_pending_frame, frame);
+ // Receive and track the resources referenced from the CompositorFrame
+ // regardless of whether it's pending or active.
+ factory_->ReceiveFromChild(frame.resource_list);
+
if (!blocking_surfaces_.empty()) {
pending_frame_ = std::move(frame);
- if (pending_frame_) {
- factory_->ReceiveFromChild(pending_frame_->resource_list);
- pending_referenced_surfaces_ =
- pending_frame_->metadata.referenced_surfaces;
- // Ask the surface manager to inform |this| when its dependencies are
- // resolved.
- factory_->manager()->RequestSurfaceResolution(this);
- }
+ pending_referenced_surfaces_ = pending_frame_->metadata.referenced_surfaces;
+ // Ask the surface manager to inform |this| when its dependencies are
+ // resolved.
+ factory_->manager()->RequestSurfaceResolution(this);
} else {
// If there are no blockers, then immediately activate the frame.
ActivateFrame(std::move(frame));
@@ -152,8 +152,6 @@ void Surface::ActivatePendingFrame() {
ActivateFrame(std::move(pending_frame_.value()));
pending_frame_.reset();
pending_referenced_surfaces_.clear();
- // ActiveFrame resources are now double ref-ed. Unref.
- UnrefFrameResources(*active_frame_);
}
// A frame is activated if all its Surface ID dependences are active or a
@@ -168,8 +166,6 @@ void Surface::ActivateFrame(CompositorFrame frame) {
base::Optional<CompositorFrame> previous_frame = std::move(active_frame_);
active_frame_ = std::move(frame);
- factory_->ReceiveFromChild(active_frame_->resource_list);
-
// Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
// increment frame index for them.
if (!active_frame_->render_pass_list.empty())
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698