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

Unified Diff: Source/wtf/RawPtr.h

Issue 183833009: Oilpan: Allowing hashing of RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
« Source/wtf/HashTraits.h ('K') | « Source/wtf/HashTraits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« Source/wtf/HashTraits.h ('K') | « Source/wtf/HashTraits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698