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

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

Issue 1304043002: Make classes and structures in core/dom fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/dom/DocumentLifecycle.h ('k') | Source/core/dom/ElementDataCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef DocumentOrderedMap_h 31 #ifndef DocumentOrderedMap_h
32 #define DocumentOrderedMap_h 32 #define DocumentOrderedMap_h
33 33
34 #include "platform/heap/Handle.h" 34 #include "platform/heap/Handle.h"
35 #include "wtf/Allocator.h"
35 #include "wtf/Forward.h" 36 #include "wtf/Forward.h"
36 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
37 #include "wtf/text/AtomicString.h" 38 #include "wtf/text/AtomicString.h"
38 #include "wtf/text/AtomicStringHash.h" 39 #include "wtf/text/AtomicStringHash.h"
39 #include "wtf/text/StringImpl.h" 40 #include "wtf/text/StringImpl.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class Element; 44 class Element;
44 class TreeScope; 45 class TreeScope;
45 46
46 class DocumentOrderedMap : public NoBaseWillBeGarbageCollected<DocumentOrderedMa p> { 47 class DocumentOrderedMap : public NoBaseWillBeGarbageCollected<DocumentOrderedMa p> {
48 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DocumentOrderedMap);
47 public: 49 public:
48 static PassOwnPtrWillBeRawPtr<DocumentOrderedMap> create(); 50 static PassOwnPtrWillBeRawPtr<DocumentOrderedMap> create();
49 void add(const AtomicString&, Element*); 51 void add(const AtomicString&, Element*);
50 void remove(const AtomicString&, Element*); 52 void remove(const AtomicString&, Element*);
51 53
52 bool contains(const AtomicString&) const; 54 bool contains(const AtomicString&) const;
53 bool containsMultiple(const AtomicString&) const; 55 bool containsMultiple(const AtomicString&) const;
54 // concrete instantiations of the get<>() method template 56 // concrete instantiations of the get<>() method template
55 Element* getElementById(const AtomicString&, const TreeScope*) const; 57 Element* getElementById(const AtomicString&, const TreeScope*) const;
56 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons t AtomicString&, const TreeScope*) const; 58 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons t AtomicString&, const TreeScope*) const;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const 94 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const
93 { 95 {
94 Map::const_iterator it = m_map.find(id); 96 Map::const_iterator it = m_map.find(id);
95 return it != m_map.end() && it->value->count > 1; 97 return it != m_map.end() && it->value->count > 1;
96 } 98 }
97 99
98 } // namespace blink 100 } // namespace blink
99 101
100 #endif // DocumentOrderedMap_h 102 #endif // DocumentOrderedMap_h
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentLifecycle.h ('k') | Source/core/dom/ElementDataCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698