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

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

Issue 10703124: Merge 121103 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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/WebCore/dom/NodeRareData.h
===================================================================
--- Source/WebCore/dom/NodeRareData.h (revision 122248)
+++ Source/WebCore/dom/NodeRareData.h (working copy)
@@ -49,8 +49,18 @@
struct NodeListsNodeData {
WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
public:
- typedef HashMap<std::pair<unsigned short, AtomicString>, DynamicSubtreeNodeList*> NodeListAtomicNameCacheMap;
- typedef HashMap<std::pair<unsigned short, String>, DynamicSubtreeNodeList*> NodeListNameCacheMap;
+ template <typename StringType>
+ struct NodeListCacheMapEntryHash : public WTF::PairHash<unsigned char, StringType> {
+ static unsigned hash(const std::pair<unsigned char, StringType>& entry)
+ {
+ return DefaultHash<StringType>::Hash::hash(entry.second) + entry.first;
+ }
+ static bool equal(const std::pair<unsigned char, StringType>& a, const std::pair<unsigned char, StringType>& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = DefaultHash<StringType>::Hash::safeToCompareToEmptyOrDeleted;
+ };
+
+ typedef HashMap<std::pair<unsigned char, AtomicString>, DynamicSubtreeNodeList*, NodeListCacheMapEntryHash<AtomicString> > NodeListAtomicNameCacheMap;
+ typedef HashMap<std::pair<unsigned char, String>, DynamicSubtreeNodeList*, NodeListCacheMapEntryHash<String> > NodeListNameCacheMap;
typedef HashMap<QualifiedName, TagNodeList*> TagNodeListCacheNS;
template<typename T>
@@ -151,14 +161,14 @@
private:
NodeListsNodeData() { }
- std::pair<unsigned short, AtomicString> namedNodeListKey(DynamicNodeList::NodeListType listType, const AtomicString& name)
+ std::pair<unsigned char, AtomicString> namedNodeListKey(DynamicNodeList::NodeListType listType, const AtomicString& name)
{
- return std::pair<unsigned short, AtomicString>(listType, name);
+ return std::pair<unsigned char, AtomicString>(listType, name);
}
- std::pair<unsigned short, String> namedNodeListKey(DynamicNodeList::NodeListType listType, const String& name)
+ std::pair<unsigned char, String> namedNodeListKey(DynamicNodeList::NodeListType listType, const String& name)
{
- return std::pair<unsigned short, String>(listType, name);
+ return std::pair<unsigned char, String>(listType, name);
}
NodeListAtomicNameCacheMap m_atomicNameCaches;
« 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