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

Unified Diff: cc/surfaces/surface.cc

Issue 2940183002: cc: Move ownership of surfaces to SurfaceManager (Closed)
Patch Set: c Created 3 years, 6 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/surfaces/surface.cc
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 9be53ad344321bf0cdda2f32a160713ca125df23..164f8b59d3b52c4fab5ac8fd91cc00f02296d14e 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -30,7 +30,8 @@ Surface::Surface(
compositor_frame_sink_support_(std::move(compositor_frame_sink_support)),
surface_manager_(compositor_frame_sink_support_->surface_manager()),
frame_index_(kFrameIndexStart),
- destroyed_(false) {}
+ destroyed_(false),
+ weak_factory_(this) {}
Surface::~Surface() {
ClearCopyRequests();
@@ -376,4 +377,8 @@ void Surface::TakeLatencyInfoFromFrame(
frame->metadata.latency_info.clear();
}
+base::WeakPtr<Surface> Surface::AsWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698