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..bd2b5788851ff48b81f8ab762a647544909e98ad 100644 |
| --- a/cc/surfaces/surface_manager.h |
| +++ b/cc/surfaces/surface_manager.h |
| @@ -26,6 +26,11 @@ |
| #include "cc/surfaces/surface_sequence.h" |
| #include "cc/surfaces/surfaces_export.h" |
| +#if DCHECK_IS_ON() |
|
danakj
2017/01/18 16:57:11
should include base/logging.h for this macro
kylechar
2017/01/18 18:04:58
Done.
|
| +#include <iosfwd> |
| +#include <string> |
| +#endif |
| + |
| namespace cc { |
| class BeginFrameSource; |
| class CompositorFrame; |
| @@ -43,6 +48,11 @@ class CC_SURFACES_EXPORT SurfaceManager |
| explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); |
| ~SurfaceManager() override; |
| +#if DCHECK_IS_ON() |
| + // Returns a string representation of all reachable surface references. |
| + std::string SurfaceReferencesToString(); |
| +#endif |
| + |
| void RegisterSurface(Surface* surface); |
| void DeregisterSurface(const SurfaceId& surface_id); |
| @@ -126,6 +136,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 +157,13 @@ class CC_SURFACES_EXPORT SurfaceManager |
| void RemoveSurfaceReferenceImpl(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, |
| + std::string indent, |
| + std::stringstream* str); |
| +#endif |
| + |
| // Use reference or sequence based lifetime management. |
| LifetimeType lifetime_type_; |
| @@ -184,7 +203,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. |