Index: Source/wtf/OwnPtr.h |
diff --git a/Source/wtf/OwnPtr.h b/Source/wtf/OwnPtr.h |
index e0dde828cec1773f281a3f33752b0897aefeed10..a923b152973ddda9597db4594670a1df1ea89619 100644 |
--- a/Source/wtf/OwnPtr.h |
+++ b/Source/wtf/OwnPtr.h |
@@ -22,6 +22,7 @@ |
#ifndef WTF_OwnPtr_h |
#define WTF_OwnPtr_h |
+#include "wtf/HashTableDeletedValueType.h" |
#include "wtf/Noncopyable.h" |
#include "wtf/NullPtr.h" |
#include "wtf/OwnPtrCommon.h" |
@@ -49,6 +50,10 @@ namespace WTF { |
OwnPtr(const PassOwnPtr<T>&); |
template<typename U> OwnPtr(const PassOwnPtr<U>&, EnsurePtrConvertibleArgDecl(U, T)); |
+ // Hash table deleted values, which are only constructed and never copied or destroyed. |
+ OwnPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } |
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } |
+ |
#if !COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
// This copy constructor is used implicitly by gcc when it generates |
// transients for assigning a PassOwnPtr<T> object to a stack-allocated |
@@ -94,6 +99,8 @@ namespace WTF { |
void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); } |
+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
+ |
private: |
#if !COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
// If rvalue references are supported, noncopyable takes care of this. |