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

Side by Side Diff: Source/core/dom/DocumentOrderedMap.h

Issue 947393002: InlinedVisitor: Migrate dom to use inlined tracing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 bool contains(const AtomicString&) const; 52 bool contains(const AtomicString&) const;
53 bool containsMultiple(const AtomicString&) const; 53 bool containsMultiple(const AtomicString&) const;
54 // concrete instantiations of the get<>() method template 54 // concrete instantiations of the get<>() method template
55 Element* getElementById(const AtomicString&, const TreeScope*) const; 55 Element* getElementById(const AtomicString&, const TreeScope*) const;
56 const WillBeHeapVector<RawPtrWillBeMember<Element> >& getAllElementsById(con st AtomicString&, const TreeScope*) const; 56 const WillBeHeapVector<RawPtrWillBeMember<Element> >& getAllElementsById(con st AtomicString&, const TreeScope*) const;
57 Element* getElementByMapName(const AtomicString&, const TreeScope*) const; 57 Element* getElementByMapName(const AtomicString&, const TreeScope*) const;
58 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope* ) const; 58 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope* ) const;
59 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope* ) const; 59 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope* ) const;
60 60
61 void trace(Visitor*); 61 DECLARE_TRACE();
62 62
63 private: 63 private:
64 template<bool keyMatches(const AtomicString&, const Element&)> 64 template<bool keyMatches(const AtomicString&, const Element&)>
65 Element* get(const AtomicString&, const TreeScope*) const; 65 Element* get(const AtomicString&, const TreeScope*) const;
66 66
67 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> { 67 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> {
68 public: 68 public:
69 explicit MapEntry(Element* firstElement) 69 explicit MapEntry(Element* firstElement)
70 : element(firstElement) 70 : element(firstElement)
71 , count(1) 71 , count(1)
72 { 72 {
73 } 73 }
74 74
75 void trace(Visitor*); 75 DECLARE_TRACE();
76 76
77 RawPtrWillBeMember<Element> element; 77 RawPtrWillBeMember<Element> element;
78 unsigned count; 78 unsigned count;
79 WillBeHeapVector<RawPtrWillBeMember<Element> > orderedList; 79 WillBeHeapVector<RawPtrWillBeMember<Element> > orderedList;
80 }; 80 };
81 81
82 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; 82 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>;
83 83
84 mutable Map m_map; 84 mutable Map m_map;
85 }; 85 };
86 86
87 inline bool DocumentOrderedMap::contains(const AtomicString& id) const 87 inline bool DocumentOrderedMap::contains(const AtomicString& id) const
88 { 88 {
89 return m_map.contains(id); 89 return m_map.contains(id);
90 } 90 }
91 91
92 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const 92 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const
93 { 93 {
94 Map::const_iterator it = m_map.find(id); 94 Map::const_iterator it = m_map.find(id);
95 return it != m_map.end() && it->value->count > 1; 95 return it != m_map.end() && it->value->count > 1;
96 } 96 }
97 97
98 } // namespace blink 98 } // namespace blink
99 99
100 #endif // DocumentOrderedMap_h 100 #endif // DocumentOrderedMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698