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

Unified Diff: Source/core/dom/NodeRareData.h

Issue 141743010: Use a StringImpl* instead of an AtomicString for NodeListAtomicNameCacheMap's key (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeRareData.h
diff --git a/Source/core/dom/NodeRareData.h b/Source/core/dom/NodeRareData.h
index 403a0b2cc7492bba5265d8653d530301231c13e1..950f3946dbfc98f5f429ae0ee1c0353671eff493 100644
--- a/Source/core/dom/NodeRareData.h
+++ b/Source/core/dom/NodeRareData.h
@@ -94,7 +94,16 @@ public:
static const bool safeToCompareToEmptyOrDeleted = DefaultHash<StringType>::Hash::safeToCompareToEmptyOrDeleted;
};
- typedef HashMap<std::pair<unsigned char, AtomicString>, LiveNodeListBase*, NodeListCacheMapEntryHash<AtomicString> > NodeListAtomicNameCacheMap;
+ struct NodeListAtomicCacheMapEntryHash {
+ static unsigned hash(const std::pair<unsigned char, StringImpl*>& entry)
+ {
+ return DefaultHash<StringImpl*>::Hash::hash(entry.second) + entry.first;
+ }
+ static bool equal(const std::pair<unsigned char, StringImpl*>& a, const std::pair<unsigned char, StringImpl*>& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = DefaultHash<StringImpl*>::Hash::safeToCompareToEmptyOrDeleted;
+ };
+
+ typedef HashMap<std::pair<unsigned char, StringImpl*>, LiveNodeListBase*, NodeListAtomicCacheMapEntryHash> NodeListAtomicNameCacheMap;
typedef HashMap<std::pair<unsigned char, String>, LiveNodeListBase*, NodeListCacheMapEntryHash<String> > NodeListNameCacheMap;
typedef HashMap<QualifiedName, TagCollection*> TagCollectionCacheNS;
@@ -228,9 +237,9 @@ private:
: m_childNodeList(0)
{ }
- std::pair<unsigned char, AtomicString> namedNodeListKey(CollectionType type, const AtomicString& name)
+ std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name)
{
- return std::pair<unsigned char, AtomicString>(type, name);
+ return std::pair<unsigned char, StringImpl*>(type, name.impl());
abarth-chromium 2014/02/09 03:46:27 Why is this memory safe? What retains |name| ?
Inactive 2014/02/09 14:06:54 Nothing retains name. This is safe because we are
Inactive 2014/02/09 14:28:02 Never mind my previous comment, it is inaccurate.
}
std::pair<unsigned char, String> namedNodeListKey(CollectionType type, const String& name)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698