Index: Source/wtf/RawPtr.h |
diff --git a/Source/wtf/RawPtr.h b/Source/wtf/RawPtr.h |
index ac60e44768a2a950cfd6d5564e5d5b79ba54c26d..146aaf3d5c639a2e402a4cad2ba0d6ada072cf80 100644 |
--- a/Source/wtf/RawPtr.h |
+++ b/Source/wtf/RawPtr.h |
@@ -32,6 +32,7 @@ |
#define WTF_RawPtr_h |
#include <algorithm> |
+#include "wtf/HashTableDeletedValueType.h" |
// Ptr is a simple wrapper for a raw pointer that provides the |
// interface (get, clear) of other pointer types such as RefPtr, |
@@ -61,6 +62,10 @@ public: |
{ |
} |
+ // Hash table deleted values, which are only constructed and never copied or destroyed. |
+ RawPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } |
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } |
+ |
T* get() const { return m_ptr; } |
void clear() { m_ptr = 0; } |
// FIXME: oilpan: Remove release and leakRef once we remove RefPtrWillBeRawPtr. |
@@ -107,6 +112,7 @@ public: |
std::swap(m_ptr, o.m_ptr); |
} |
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
private: |
T* m_ptr; |