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

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

Issue 2290543002: Avoid redundant hash calculations in CustomElementUpgradeSorter (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CustomElementUpgradeSorter_h 5 #ifndef CustomElementUpgradeSorter_h
6 #define CustomElementUpgradeSorter_h 6 #define CustomElementUpgradeSorter_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 10
(...skipping 14 matching lines...) Expand all
25 void add(Element*); 25 void add(Element*);
26 26
27 // Adds shadow-including descendents of parent to result in 27 // Adds shadow-including descendents of parent to result in
28 // shadow-including tree order. This operation is destroys the 28 // shadow-including tree order. This operation is destroys the
29 // state of this sorter; after calling sorted, you must not call 29 // state of this sorter; after calling sorted, you must not call
30 // add or sorted again with this object. 30 // add or sorted again with this object.
31 void sorted(HeapVector<Member<Element>>* result, Node* parent); 31 void sorted(HeapVector<Member<Element>>* result, Node* parent);
32 32
33 private: 33 private:
34 using ChildSet = HeapHashSet<Member<Node>>; 34 using ChildSet = HeapHashSet<Member<Node>>;
35 using ParentChildMap = HeapHashMap<Member<Node>, ChildSet>; 35 using ParentChildMap = HeapHashMap<Member<Node>, Member<ChildSet>>;
36 36
37 enum AddResult { 37 enum AddResult {
38 kParentAlreadyExistsInMap, 38 kParentAlreadyExistsInMap,
39 kParentAddedToMap 39 kParentAddedToMap
40 }; 40 };
41 41
42 AddResult addToParentChildMap(Node* parent, Node* child); 42 AddResult addToParentChildMap(Node* parent, Node* child);
43 void visit( 43 void visit(
44 HeapVector<Member<Element>>* result, 44 HeapVector<Member<Element>>* result,
45 ChildSet&, 45 ChildSet&,
46 const ChildSet::iterator&); 46 const ChildSet::iterator&);
47 47
48 Member<HeapHashSet<Member<Element>>> m_elements; 48 Member<HeapHashSet<Member<Element>>> m_elements;
49 49
50 // This is the subset of the tree, from root node (usually 50 // This is the subset of the tree, from root node (usually
51 // document) through elements and shadow roots, to candidates. 51 // document) through elements and shadow roots, to candidates.
52 Member<ParentChildMap> m_parentChildMap; 52 Member<ParentChildMap> m_parentChildMap;
53 }; 53 };
54 54
55 } // namespace blink 55 } // namespace blink
56 56
57 #endif // CustomElementUpgradeSorter_h 57 #endif // CustomElementUpgradeSorter_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698