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 |