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

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

Issue 337653002: Oilpan: GC_TRACING: Improve object path dump (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Backtrace Created 6 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
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index 6de5dbc17563d21e82f0fec9aadefca5d49d8e44..4c63c1cfcefb23109ebd82f76d99210672b7a679 100644
--- a/Source/platform/heap/Handle.h
+++ b/Source/platform/heap/Handle.h
@@ -287,30 +287,32 @@ class Persistent : public PersistentBase<RootsAccessor, Persistent<T, RootsAcces
WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(Persistent);
WTF_DISALLOW_ZERO_ASSIGNMENT(Persistent);
public:
- Persistent() : m_raw(0) { }
+ Persistent() : m_raw(0) { recordBacktrace(); }
haraken 2014/06/16 01:15:40 I'm not sure if you want to record a backtrace for
- Persistent(std::nullptr_t) : m_raw(0) { }
+ Persistent(std::nullptr_t) : m_raw(0) { recordBacktrace(); }
haraken 2014/06/16 01:15:40 Ditto.
Persistent(T* raw) : m_raw(raw)
{
ASSERT_IS_VALID_PERSISTENT_POINTER(m_raw);
+ recordBacktrace();
}
explicit Persistent(T& raw) : m_raw(&raw)
{
ASSERT_IS_VALID_PERSISTENT_POINTER(m_raw);
+ recordBacktrace();
}
- Persistent(const Persistent& other) : m_raw(other) { }
+ Persistent(const Persistent& other) : m_raw(other) { recordBacktrace(); }
template<typename U>
- Persistent(const Persistent<U, RootsAccessor>& other) : m_raw(other) { }
+ Persistent(const Persistent<U, RootsAccessor>& other) : m_raw(other) { recordBacktrace(); }
template<typename U>
- Persistent(const Member<U>& other) : m_raw(other) { }
+ Persistent(const Member<U>& other) : m_raw(other) { recordBacktrace(); }
template<typename U>
- Persistent(const RawPtr<U>& other) : m_raw(other.get()) { }
+ Persistent(const RawPtr<U>& other) : m_raw(other.get()) { recordBacktrace(); }
template<typename U>
Persistent& operator=(U* other)
@@ -342,7 +344,7 @@ public:
{
COMPILE_ASSERT_IS_GARBAGE_COLLECTED(T, NonGarbageCollectedObjectInPersistent);
#if ENABLE(GC_TRACING)
- visitor->setHostInfo(this, "Persistent");
+ visitor->setHostInfo(this, m_tracingName.isEmpty() ? "Persistent" : m_tracingName);
haraken 2014/06/16 01:15:40 Just help me understand: In what situation can the
tkent 2014/06/16 02:34:47 When we forget to add recordBacktrace() :-)
#endif
visitor->mark(m_raw);
}
@@ -393,6 +395,16 @@ public:
T* get() const { return m_raw; }
private:
+#if ENABLE(GC_TRACING)
+ void recordBacktrace()
+ {
+ m_tracingName = Heap::createBacktraceString();
+ }
+
+ String m_tracingName;
+#else
+ inline void recordBacktrace() { }
+#endif
T* m_raw;
friend class CrossThreadPersistent<T>;
@@ -425,7 +437,13 @@ public:
template<typename OtherCollection>
PersistentHeapCollectionBase(const OtherCollection& other) : Collection(other) { }
- void trace(Visitor* visitor) { visitor->trace(*static_cast<Collection*>(this)); }
+ void trace(Visitor* visitor)
+ {
+#if ENABLE(GC_TRACING)
+ visitor->setHostInfo(this, "PersistentHeapCollectionBase");
+#endif
+ visitor->trace(*static_cast<Collection*>(this));
+ }
};
template<
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698