diff options
Diffstat (limited to 'JavaScriptCore/runtime/WeakGCPtr.h')
-rw-r--r-- | JavaScriptCore/runtime/WeakGCPtr.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/JavaScriptCore/runtime/WeakGCPtr.h b/JavaScriptCore/runtime/WeakGCPtr.h index 3ed4645..9dce858 100644 --- a/JavaScriptCore/runtime/WeakGCPtr.h +++ b/JavaScriptCore/runtime/WeakGCPtr.h @@ -44,10 +44,13 @@ public: return m_ptr; } - void clear(JSCell* ptr) + bool clear(JSCell* ptr) { - if (ptr == m_ptr) + if (ptr == m_ptr) { m_ptr = 0; + return true; + } + return false; } T& operator*() const { return *get(); } @@ -65,11 +68,15 @@ public: WeakGCPtr& operator=(T*); +#if !ASSERT_DISABLED + bool hasDeadObject() const { return !!m_ptr; } +#endif + private: void assign(T* ptr) { - if (ptr) - Heap::markCell(ptr); + ASSERT(ptr); + Heap::markCell(ptr); m_ptr = ptr; } |