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

Unified Diff: cc/surfaces/surface_manager.h

Issue 2638833002: Moving temporary reference logic to SurfaceManager (Closed)
Patch Set: c Created 3 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
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.cc » ('j') | cc/surfaces/surface_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_manager.h
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index b6885b81456a57a0ad6d6390afb37d5f71365e24..cb8dd7908134862a56ef22a48aab2e8712e2177f 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -126,6 +126,8 @@ class CC_SURFACES_EXPORT SurfaceManager
}
private:
+ friend class SurfaceManagerRefTest;
+
void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id,
BeginFrameSource* source);
void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id,
@@ -145,6 +147,11 @@ class CC_SURFACES_EXPORT SurfaceManager
void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id,
const SurfaceId& child_id);
+ // Adds a reference from parent id to child id without dealing with temporary
+ // references.
+ void AddSurfaceReferenceImpl(const SurfaceId& parent_id,
+ const SurfaceId& child_id);
+
// Use reference or sequence based lifetime management.
LifetimeType lifetime_type_;
@@ -208,6 +215,14 @@ class CC_SURFACES_EXPORT SurfaceManager
// references.
scoped_refptr<SurfaceReferenceFactory> reference_factory_;
+ // SurfaceIds that have temporary references from top level root so they
+ // aren't GC'd before a real reference is added. This is basically a
+ // collection of surface ids, for example:
+ // SurfaceId surface_id(key, value[index]);
+ // The LocalFrameIds are stored in the order the surfaces are created in.
+ std::unordered_map<FrameSinkId, std::vector<LocalFrameId>, FrameSinkIdHash>
+ temp_references_;
+
base::WeakPtrFactory<SurfaceManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.cc » ('j') | cc/surfaces/surface_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698