Chromium Code Reviews| Index: cc/surfaces/surface_manager.h |
| diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h |
| index b6885b81456a57a0ad6d6390afb37d5f71365e24..a43df1f6f5ab921b3e752aaeeb6c9e65b827db92 100644 |
| --- a/cc/surfaces/surface_manager.h |
| +++ b/cc/surfaces/surface_manager.h |
| @@ -9,6 +9,8 @@ |
| #include <list> |
| #include <memory> |
| +#include <sstream> |
|
danakj
2017/01/17 23:21:57
do u need more than iosfwd? and should these be in
kylechar
2017/01/18 15:06:18
iosfwd has a forward def for stringstream, so it s
|
| +#include <string> |
| #include <unordered_map> |
| #include <unordered_set> |
| #include <vector> |
| @@ -43,6 +45,11 @@ class CC_SURFACES_EXPORT SurfaceManager |
| explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); |
| ~SurfaceManager() override; |
| +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
|
danakj
2017/01/17 23:21:57
#if DCHECK_IS_ON() is the way to spell this
kylechar
2017/01/18 15:06:18
Huh, that's handy.
|
| + // Returns a string representation of all reachable surface references. |
| + std::string PrintSurfaceReferences(); |
|
danakj
2017/01/17 23:21:57
This doesnt print, SurfaceReferencesToString ?
kylechar
2017/01/18 15:06:18
Done.
|
| +#endif |
| + |
| void RegisterSurface(Surface* surface); |
| void DeregisterSurface(const SurfaceId& surface_id); |
| @@ -126,6 +133,8 @@ class CC_SURFACES_EXPORT SurfaceManager |
| } |
| private: |
| + using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>; |
| + |
| void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| BeginFrameSource* source); |
| void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| @@ -145,6 +154,13 @@ class CC_SURFACES_EXPORT SurfaceManager |
| void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id, |
| const SurfaceId& child_id); |
| +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
| + // Recursively prints surface references starting at |surface_id| to |str|. |
| + void PrintSurfaceReferencesImpl(const SurfaceId& surface_id, |
| + std::string indent, |
| + std::stringstream* str); |
| +#endif |
| + |
| // Use reference or sequence based lifetime management. |
| LifetimeType lifetime_type_; |
| @@ -184,7 +200,6 @@ class CC_SURFACES_EXPORT SurfaceManager |
| std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash> |
| frame_sink_source_map_; |
| - using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>; |
| // Tracks references from the child surface to parent surface. If there are |
| // zero entries in the set for a SurfaceId then nothing is referencing the |
| // surface and it can be garbage collected. |