Chromium Code Reviews| 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< |