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

Unified Diff: Source/wtf/HashTraits.h

Issue 14877006: Optimization of HashTraits<RefPtr<P> >::emptyValue() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 7 years, 7 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/HashTable.h ('k') | no next file » | 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 329c18b394f2792d3a51c1ec934784df8dbbf4ff..2be33c29db1f7ad702c7dc4a04e65a6a3ad5d4b5 100644
--- a/Source/wtf/HashTraits.h
+++ b/Source/wtf/HashTraits.h
@@ -138,17 +138,14 @@ namespace WTF {
};
template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > {
- static RefPtr<P>& emptyValue()
- {
- static RefPtr<P>& null = *(new RefPtr<P>);
- return null;
- }
+ static P* emptyValue() { return 0; }
typedef PassRefPtr<P> PassInType;
static void store(PassRefPtr<P> value, RefPtr<P>& storage) { storage = value; }
typedef PassRefPtr<P> PassOutType;
static PassRefPtr<P> passOut(RefPtr<P>& value) { return value.release(); }
+ static PassRefPtr<P> passOut(P* value) { return value; }
typedef P* PeekType;
static PeekType peek(const RefPtr<P>& value) { return value.get(); }
« no previous file with comments | « Source/wtf/HashTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698