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

Unified Diff: cc/surfaces/surface_manager.h

Issue 2625203004: Add debug method to print surface references. (Closed)
Patch Set: Little fixes. 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 | « cc/surfaces/surface.cc ('k') | 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 b6885b81456a57a0ad6d6390afb37d5f71365e24..47651b77c07bd88d9ca148480d19b661cf1e1119 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -14,6 +14,7 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
@@ -26,6 +27,11 @@
#include "cc/surfaces/surface_sequence.h"
#include "cc/surfaces/surfaces_export.h"
+#if DCHECK_IS_ON()
+#include <iosfwd>
+#include <string>
+#endif
+
namespace cc {
class BeginFrameSource;
class CompositorFrame;
@@ -43,6 +49,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 +137,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 +158,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 +204,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.
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698