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

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') | no next file with comments »
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 47651b77c07bd88d9ca148480d19b661cf1e1119..ef6a73512a363292dee334deb02120c6aa0165a5 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -137,6 +137,8 @@ class CC_SURFACES_EXPORT SurfaceManager
}
private:
+ friend class SurfaceManagerRefTest;
+
using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>;
void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id,
@@ -158,6 +160,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);
+
#if DCHECK_IS_ON()
// Recursively prints surface references starting at |surface_id| to |str|.
void SurfaceReferencesToStringImpl(const SurfaceId& surface_id,
@@ -227,6 +234,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698