OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 17 matching lines...) Expand all Loading... |
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 CustomElementUpgradeCandidateMap_h | 31 #ifndef CustomElementUpgradeCandidateMap_h |
32 #define CustomElementUpgradeCandidateMap_h | 32 #define CustomElementUpgradeCandidateMap_h |
33 | 33 |
34 #include "core/dom/custom/CustomElementDescriptor.h" | 34 #include "core/dom/custom/CustomElementDescriptor.h" |
35 #include "core/dom/custom/CustomElementDescriptorHash.h" | 35 #include "core/dom/custom/CustomElementDescriptorHash.h" |
36 #include "core/dom/custom/CustomElementObserver.h" | 36 #include "core/dom/custom/CustomElementObserver.h" |
37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
38 #include "wtf/ListHashSet.h" | 38 #include "wtf/LinkedHashSet.h" |
39 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 class Element; | 43 class Element; |
44 | 44 |
45 class CustomElementUpgradeCandidateMap : CustomElementObserver { | 45 class CustomElementUpgradeCandidateMap FINAL : public CustomElementObserver { |
46 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); | 46 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); |
47 public: | 47 public: |
48 CustomElementUpgradeCandidateMap() { } | 48 static PassOwnPtrWillBeRawPtr<CustomElementUpgradeCandidateMap> create(); |
49 ~CustomElementUpgradeCandidateMap(); | 49 virtual ~CustomElementUpgradeCandidateMap(); |
50 | 50 |
51 // API for CustomElementRegistrationContext to save and take candidates | 51 // API for CustomElementRegistrationContext to save and take candidates |
52 | 52 |
53 typedef ListHashSet<Element*> ElementSet; | 53 typedef WillBeHeapLinkedHashSet<RawPtrWillBeWeakMember<Element> > ElementSet
; |
54 | 54 |
55 void add(const CustomElementDescriptor&, Element*); | 55 void add(const CustomElementDescriptor&, Element*); |
56 void remove(Element*); | 56 PassOwnPtrWillBeRawPtr<ElementSet> takeUpgradeCandidatesFor(const CustomElem
entDescriptor&); |
57 ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&); | 57 |
| 58 virtual void trace(Visitor*) OVERRIDE; |
58 | 59 |
59 private: | 60 private: |
| 61 CustomElementUpgradeCandidateMap() { } |
| 62 |
60 virtual void elementWasDestroyed(Element*) OVERRIDE; | 63 virtual void elementWasDestroyed(Element*) OVERRIDE; |
61 void removeCommon(Element*); | |
62 | 64 |
63 virtual void elementDidFinishParsingChildren(Element*) OVERRIDE; | 65 virtual void elementDidFinishParsingChildren(Element*) OVERRIDE; |
64 void moveToEnd(Element*); | 66 void moveToEnd(Element*); |
65 | 67 |
66 typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap; | 68 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Element>, CustomElementDesc
riptor> UpgradeCandidateMap; |
67 UpgradeCandidateMap m_upgradeCandidates; | 69 UpgradeCandidateMap m_upgradeCandidates; |
68 | 70 |
69 typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap
; | 71 typedef WillBeHeapHashMap<CustomElementDescriptor, OwnPtrWillBeMember<Elemen
tSet> > UnresolvedDefinitionMap; |
70 UnresolvedDefinitionMap m_unresolvedDefinitions; | 72 UnresolvedDefinitionMap m_unresolvedDefinitions; |
71 }; | 73 }; |
72 | 74 |
73 } | 75 } |
74 | 76 |
75 #endif // CustomElementUpgradeCandidateMap_h | 77 #endif // CustomElementUpgradeCandidateMap_h |
OLD | NEW |