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

Unified Diff: Source/wtf/HashTraits.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
« no previous file with comments | « Source/wtf/HashFunctions.h ('k') | Source/wtf/RawPtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTraits.h
diff --git a/Source/wtf/HashTraits.h b/Source/wtf/HashTraits.h
index 5a4371459a5adfcf83213f5353d203aa7eacfc61..af1fb02bba3a8e9cc9a6a1e5b0dd09b79e8c3197 100644
--- a/Source/wtf/HashTraits.h
+++ b/Source/wtf/HashTraits.h
@@ -86,7 +86,6 @@ namespace WTF {
typedef const T* IteratorConstGetType;
typedef T& IteratorReferenceType;
typedef const T& IteratorConstReferenceType;
- static IteratorConstGetType getToConstGetConversion(const T* x) { return x; }
tkent 2014/03/03 10:19:57 Why do you remove this line?
Mads Ager (chromium) 2014/03/03 10:20:50 Because it is unused in the code base. :)
tkent 2014/03/03 10:23:43 I see. I don't think we should include this chang
Mads Ager (chromium) 2014/03/03 10:30:35 It seems to me that removing dead code is always a
static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { return *x; }
static IteratorConstReferenceType getToReferenceConstConversion(IteratorConstGetType x) { return *x; }
// Type for functions that take ownership, such as add.
@@ -191,6 +190,26 @@ namespace WTF {
static PeekOutType peek(std::nullptr_t) { return 0; }
};
+ template<typename T> struct HashTraits<RawPtr<T> > : SimpleClassHashTraits<RawPtr<T> > {
+ static const bool needsDestruction = false;
+ typedef T* PeekInType;
+ typedef T* PassInType;
+ typedef RawPtr<T>* IteratorGetType;
+ typedef const RawPtr<T>* IteratorConstGetType;
+ typedef RawPtr<T>& IteratorReferenceType;
+ typedef T* const IteratorConstReferenceType;
Mikhail 2014/03/03 10:25:56 could I ask why 'IteratorReferenceType' and 'Itera
Mads Ager (chromium) 2014/03/03 10:29:00 Yes, there is no reason for the extra indirection
+ static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { return *x; }
+ static IteratorConstReferenceType getToReferenceConstConversion(IteratorConstGetType x) { return x->get(); }
+ typedef T* PeekOutType;
+ typedef T* PassOutType;
+
+ template<typename U>
+ static void store(const U& value, RawPtr<T>& storage) { storage = value; }
+
+ static PeekOutType peek(const RawPtr<T>& value) { return value; }
+ static PassOutType passOut(const RawPtr<T>& value) { return value; }
+ };
+
template<> struct HashTraits<String> : SimpleClassHashTraits<String> {
static const bool hasIsEmptyValueFunction = true;
static bool isEmptyValue(const String&);
« no previous file with comments | « Source/wtf/HashFunctions.h ('k') | Source/wtf/RawPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698