Chromium Code Reviews| 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) |