OLD | NEW |
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 CustomElementsRegistry_h | 5 #ifndef CustomElementsRegistry_h |
6 #define CustomElementsRegistry_h | 6 #define CustomElementsRegistry_h |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/HashSet.h" |
12 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
13 #include "wtf/text/AtomicString.h" | 14 #include "wtf/text/AtomicString.h" |
14 #include "wtf/text/AtomicStringHash.h" | 15 #include "wtf/text/AtomicStringHash.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 class CustomElementDefinition; | 19 class CustomElementDefinition; |
19 class CustomElementDefinitionBuilder; | 20 class CustomElementDefinitionBuilder; |
20 class CustomElementDescriptor; | 21 class CustomElementDescriptor; |
21 class Document; | 22 class Document; |
22 class Element; | 23 class Element; |
23 class ElementRegistrationOptions; | 24 class ElementRegistrationOptions; |
24 class ExceptionState; | 25 class ExceptionState; |
25 class ScriptState; | 26 class ScriptState; |
26 class ScriptValue; | 27 class ScriptValue; |
27 class V0CustomElementRegistrationContext; | 28 class V0CustomElementRegistrationContext; |
28 | 29 |
29 class CORE_EXPORT CustomElementsRegistry final | 30 class CORE_EXPORT CustomElementsRegistry final |
30 : public GarbageCollected<CustomElementsRegistry> | 31 : public GarbageCollectedFinalized<CustomElementsRegistry> |
31 , public ScriptWrappable { | 32 , public ScriptWrappable { |
32 DEFINE_WRAPPERTYPEINFO(); | 33 DEFINE_WRAPPERTYPEINFO(); |
33 WTF_MAKE_NONCOPYABLE(CustomElementsRegistry); | 34 WTF_MAKE_NONCOPYABLE(CustomElementsRegistry); |
34 public: | 35 public: |
35 static CustomElementsRegistry* create(Document*); | 36 static CustomElementsRegistry* create(Document*); |
36 | 37 |
| 38 virtual ~CustomElementsRegistry() = default; |
| 39 |
37 void define( | 40 void define( |
38 ScriptState*, | 41 ScriptState*, |
39 const AtomicString& name, | 42 const AtomicString& name, |
40 const ScriptValue& constructor, | 43 const ScriptValue& constructor, |
41 const ElementRegistrationOptions&, | 44 const ElementRegistrationOptions&, |
42 ExceptionState&); | 45 ExceptionState&); |
43 | 46 |
44 void define( | 47 void define( |
45 const AtomicString& name, | 48 const AtomicString& name, |
46 CustomElementDefinitionBuilder&, | 49 CustomElementDefinitionBuilder&, |
(...skipping 15 matching lines...) Expand all Loading... |
62 | 65 |
63 CustomElementsRegistry(Document*); | 66 CustomElementsRegistry(Document*); |
64 | 67 |
65 V0CustomElementRegistrationContext* v0(); | 68 V0CustomElementRegistrationContext* v0(); |
66 bool v0NameIsDefined(const AtomicString& name); | 69 bool v0NameIsDefined(const AtomicString& name); |
67 | 70 |
68 void collectCandidates( | 71 void collectCandidates( |
69 const CustomElementDescriptor&, | 72 const CustomElementDescriptor&, |
70 HeapVector<Member<Element>>*); | 73 HeapVector<Member<Element>>*); |
71 | 74 |
| 75 class NameIsBeingDefined; |
| 76 |
| 77 HashSet<AtomicString> m_namesBeingDefined; |
72 using DefinitionMap = | 78 using DefinitionMap = |
73 HeapHashMap<AtomicString, Member<CustomElementDefinition>>; | 79 HeapHashMap<AtomicString, Member<CustomElementDefinition>>; |
74 DefinitionMap m_definitions; | 80 DefinitionMap m_definitions; |
75 | 81 |
76 Member<Document> m_document; | 82 Member<Document> m_document; |
77 | 83 |
78 using UpgradeCandidateSet = HeapHashSet<WeakMember<Element>>; | 84 using UpgradeCandidateSet = HeapHashSet<WeakMember<Element>>; |
79 using UpgradeCandidateMap = HeapHashMap< | 85 using UpgradeCandidateMap = HeapHashMap< |
80 AtomicString, | 86 AtomicString, |
81 Member<UpgradeCandidateSet>>; | 87 Member<UpgradeCandidateSet>>; |
82 Member<UpgradeCandidateMap> m_upgradeCandidates; | 88 Member<UpgradeCandidateMap> m_upgradeCandidates; |
83 }; | 89 }; |
84 | 90 |
85 } // namespace blink | 91 } // namespace blink |
86 | 92 |
87 #endif // CustomElementsRegistry_h | 93 #endif // CustomElementsRegistry_h |
OLD | NEW |