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

Unified Diff: Source/platform/heap/Visitor.h

Issue 1203493004: [tracing] Adding class-wise memory statistics to blink gc memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index 60cca5cd57156ff459003a7945c3c9fef89c6f21..71c98d9389d20d75a9442bb51c01eefeb3a1d47c 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -42,10 +42,8 @@
#include "wtf/HashMap.h"
#include "wtf/HashTraits.h"
#include "wtf/TypeTraits.h"
-#if ENABLE(GC_PROFILING)
#include "wtf/InstanceCounter.h"
#include "wtf/text/WTFString.h"
-#endif
namespace blink {
@@ -396,12 +394,30 @@ public:
inline MarkingMode markingMode() const { return m_markingMode; }
+ void setHostInfo(void* object, const String& name)
+ {
+ m_hostObject = object;
+ m_hostName = name;
+ }
+
+ inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor; }
+
protected:
explicit Visitor(MarkingMode markingMode)
: m_markingMode(markingMode)
{ }
virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0;
+#if ENABLE(GC_PROFILING)
+ virtual void recordObjectGraphEdge(const void*) = 0;
+#endif
+
+ void* m_hostObject;
+ String m_hostName;
+
+#if ENABLE(ASSERT)
+ virtual void checkMarkingAllowed() { }
+#endif
private:
static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_cast<Visitor*>(helper); }
@@ -411,6 +427,16 @@ private:
};
#if ENABLE(GC_PROFILING)
+template <typename Derived>
+template <typename T>
+void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* obj)
+{
+ T** cell = reinterpret_cast<T**>(obj);
+ if (*cell && !self->isHeapObjectAlive(*cell))
+ *cell = nullptr;
+}
+#endif
+
template<typename T>
struct TypenameStringTrait {
static const String& get()
@@ -419,7 +445,6 @@ struct TypenameStringTrait {
return typenameString;
}
};
-#endif
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698