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

Side by Side Diff: third_party/WebKit/Source/core/dom/NthIndexCache.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NthIndexCache_h 5 #ifndef NthIndexCache_h
6 #define NthIndexCache_h 6 #define NthIndexCache_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/HashMap.h" 11 #include "wtf/HashMap.h"
12 #include "wtf/OwnPtr.h" 12 #include "wtf/OwnPtr.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class Document; 17 class Document;
18 18
19 class CORE_EXPORT NthIndexData final : public NoBaseWillBeGarbageCollected<NthIn dexData> { 19 class CORE_EXPORT NthIndexData final : public GarbageCollected<NthIndexData> {
20 USING_FAST_MALLOC_WILL_BE_REMOVED(NthIndexData);
21 WTF_MAKE_NONCOPYABLE(NthIndexData); 20 WTF_MAKE_NONCOPYABLE(NthIndexData);
22 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NthIndexData);
23 public: 21 public:
24 NthIndexData() { } 22 NthIndexData() { }
25 23
26 unsigned nthIndex(Element&); 24 unsigned nthIndex(Element&);
27 unsigned nthIndexOfType(Element&, const QualifiedName&); 25 unsigned nthIndexOfType(Element&, const QualifiedName&);
28 unsigned nthLastIndex(Element&); 26 unsigned nthLastIndex(Element&);
29 unsigned nthLastIndexOfType(Element&, const QualifiedName&); 27 unsigned nthLastIndexOfType(Element&, const QualifiedName&);
30 28
31 private: 29 private:
32 unsigned cacheNthIndices(Element&); 30 unsigned cacheNthIndices(Element&);
33 unsigned cacheNthIndicesOfType(Element&, const QualifiedName&); 31 unsigned cacheNthIndicesOfType(Element&, const QualifiedName&);
34 32
35 WillBeHeapHashMap<RawPtrWillBeMember<Element>, unsigned> m_elementIndexMap; 33 HeapHashMap<Member<Element>, unsigned> m_elementIndexMap;
36 unsigned m_count = 0; 34 unsigned m_count = 0;
37 35
38 DECLARE_TRACE(); 36 DECLARE_TRACE();
39 }; 37 };
40 38
41 class CORE_EXPORT NthIndexCache final { 39 class CORE_EXPORT NthIndexCache final {
42 STACK_ALLOCATED(); 40 STACK_ALLOCATED();
43 WTF_MAKE_NONCOPYABLE(NthIndexCache); 41 WTF_MAKE_NONCOPYABLE(NthIndexCache);
44 public: 42 public:
45 explicit NthIndexCache(Document&); 43 explicit NthIndexCache(Document&);
(...skipping 17 matching lines...) Expand all
63 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element ); 61 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element );
64 } 62 }
65 63
66 unsigned nthLastChildIndexOfType(Element& element, const QualifiedName& type ) 64 unsigned nthLastChildIndexOfType(Element& element, const QualifiedName& type )
67 { 65 {
68 ASSERT(element.parentNode()); 66 ASSERT(element.parentNode());
69 return nthIndexDataWithTagName(element).nthLastIndexOfType(element, type ); 67 return nthIndexDataWithTagName(element).nthLastIndexOfType(element, type );
70 } 68 }
71 69
72 private: 70 private:
73 using IndexByType = WillBeHeapHashMap<String, OwnPtrWillBeMember<NthIndexDat a>>; 71 using IndexByType = HeapHashMap<String, Member<NthIndexData>>;
74 using ParentMap = WillBeHeapHashMap<RefPtrWillBeMember<Node>, OwnPtrWillBeMe mber<NthIndexData>>; 72 using ParentMap = HeapHashMap<Member<Node>, Member<NthIndexData>>;
75 using ParentMapForType = WillBeHeapHashMap<RefPtrWillBeMember<Node>, OwnPtrW illBeMember<IndexByType>>; 73 using ParentMapForType = HeapHashMap<Member<Node>, Member<IndexByType>>;
76 74
77 NthIndexData& ensureNthIndexDataFor(Node&); 75 NthIndexData& ensureNthIndexDataFor(Node&);
78 IndexByType& ensureTypeIndexMap(Node&); 76 IndexByType& ensureTypeIndexMap(Node&);
79 NthIndexData& nthIndexDataWithTagName(Element&); 77 NthIndexData& nthIndexDataWithTagName(Element&);
80 78
81 RawPtrWillBeMember<Document> m_document; 79 Member<Document> m_document;
82 OwnPtrWillBeMember<ParentMap> m_parentMap; 80 Member<ParentMap> m_parentMap;
83 OwnPtrWillBeMember<ParentMapForType> m_parentMapForType; 81 Member<ParentMapForType> m_parentMapForType;
84 82
85 #if ENABLE(ASSERT) 83 #if ENABLE(ASSERT)
86 uint64_t m_domTreeVersion; 84 uint64_t m_domTreeVersion;
87 #endif 85 #endif
88 }; 86 };
89 87
90 } // namespace blink 88 } // namespace blink
91 89
92 #endif // NthIndexCache_h 90 #endif // NthIndexCache_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698