Chromium Code Reviews| 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 CustomElementRegistry_h | 5 #ifndef CustomElementRegistry_h |
| 6 #define CustomElementRegistry_h | 6 #define CustomElementRegistry_h |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "bindings/core/v8/TraceWrapperMember.h" | |
| 11 #include "core/CoreExport.h" | 12 #include "core/CoreExport.h" |
| 13 #include "core/dom/custom/CustomElementDefinition.h" | |
| 12 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 13 #include "platform/wtf/Noncopyable.h" | 15 #include "platform/wtf/Noncopyable.h" |
| 14 #include "platform/wtf/text/AtomicString.h" | 16 #include "platform/wtf/text/AtomicString.h" |
| 15 #include "platform/wtf/text/AtomicStringHash.h" | 17 #include "platform/wtf/text/AtomicStringHash.h" |
| 16 | 18 |
| 17 namespace blink { | 19 namespace blink { |
| 18 | 20 |
| 19 class CustomElementDefinition; | |
| 20 class CustomElementDefinitionBuilder; | 21 class CustomElementDefinitionBuilder; |
| 21 class CustomElementDescriptor; | 22 class CustomElementDescriptor; |
| 22 class Element; | 23 class Element; |
| 23 class ElementDefinitionOptions; | 24 class ElementDefinitionOptions; |
| 24 class ExceptionState; | 25 class ExceptionState; |
| 25 class LocalDOMWindow; | 26 class LocalDOMWindow; |
| 26 class ScriptPromiseResolver; | 27 class ScriptPromiseResolver; |
| 27 class ScriptState; | 28 class ScriptState; |
| 28 class ScriptValue; | 29 class ScriptValue; |
| 29 class V0CustomElementRegistrationContext; | 30 class V0CustomElementRegistrationContext; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 46 ExceptionState&); | 47 ExceptionState&); |
| 47 | 48 |
| 48 CustomElementDefinition* define(const AtomicString& name, | 49 CustomElementDefinition* define(const AtomicString& name, |
| 49 CustomElementDefinitionBuilder&, | 50 CustomElementDefinitionBuilder&, |
| 50 const ElementDefinitionOptions&, | 51 const ElementDefinitionOptions&, |
| 51 ExceptionState&); | 52 ExceptionState&); |
| 52 | 53 |
| 53 ScriptValue get(const AtomicString& name); | 54 ScriptValue get(const AtomicString& name); |
| 54 bool NameIsDefined(const AtomicString& name) const; | 55 bool NameIsDefined(const AtomicString& name) const; |
| 55 CustomElementDefinition* DefinitionForName(const AtomicString& name) const; | 56 CustomElementDefinition* DefinitionForName(const AtomicString& name) const; |
| 57 CustomElementDefinition* DefinitionForId(CustomElementDefinition::Id) const; | |
|
kochi
2017/04/28 06:24:16
Make this private.
| |
| 56 | 58 |
| 57 // TODO(dominicc): Switch most callers of definitionForName to | 59 // TODO(dominicc): Switch most callers of definitionForName to |
| 58 // definitionFor when implementing type extensions. | 60 // definitionFor when implementing type extensions. |
| 59 CustomElementDefinition* DefinitionFor(const CustomElementDescriptor&) const; | 61 CustomElementDefinition* DefinitionFor(const CustomElementDescriptor&) const; |
| 60 | 62 |
| 61 // TODO(dominicc): Consider broadening this API when type extensions are | 63 // TODO(dominicc): Consider broadening this API when type extensions are |
| 62 // implemented. | 64 // implemented. |
| 63 void AddCandidate(Element*); | 65 void AddCandidate(Element*); |
| 64 ScriptPromise whenDefined(ScriptState*, | 66 ScriptPromise whenDefined(ScriptState*, |
| 65 const AtomicString& name, | 67 const AtomicString& name, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 76 CustomElementRegistry(const LocalDOMWindow*); | 78 CustomElementRegistry(const LocalDOMWindow*); |
| 77 | 79 |
| 78 bool V0NameIsDefined(const AtomicString& name); | 80 bool V0NameIsDefined(const AtomicString& name); |
| 79 | 81 |
| 80 void CollectCandidates(const CustomElementDescriptor&, | 82 void CollectCandidates(const CustomElementDescriptor&, |
| 81 HeapVector<Member<Element>>*); | 83 HeapVector<Member<Element>>*); |
| 82 | 84 |
| 83 class ElementDefinitionIsRunning; | 85 class ElementDefinitionIsRunning; |
| 84 bool element_definition_is_running_; | 86 bool element_definition_is_running_; |
| 85 | 87 |
| 86 using DefinitionMap = | 88 using DefinitionList = |
| 87 HeapHashMap<AtomicString, Member<CustomElementDefinition>>; | 89 HeapVector<TraceWrapperMember<CustomElementDefinition>>; |
| 88 DefinitionMap definitions_; | 90 DefinitionList definitions_; |
| 91 | |
| 92 using DefinitionMap = HashMap<AtomicString, size_t>; | |
| 93 DefinitionMap nameIdMap_; | |
|
kochi
2017/04/28 06:24:16
s/nameIdMap_/name_id_map_/
| |
| 89 | 94 |
| 90 Member<const LocalDOMWindow> owner_; | 95 Member<const LocalDOMWindow> owner_; |
| 91 | 96 |
| 92 using V0RegistrySet = | 97 using V0RegistrySet = |
| 93 HeapHashSet<WeakMember<V0CustomElementRegistrationContext>>; | 98 HeapHashSet<WeakMember<V0CustomElementRegistrationContext>>; |
| 94 Member<V0RegistrySet> v0_; | 99 Member<V0RegistrySet> v0_; |
| 95 | 100 |
| 96 using UpgradeCandidateSet = HeapHashSet<WeakMember<Element>>; | 101 using UpgradeCandidateSet = HeapHashSet<WeakMember<Element>>; |
| 97 using UpgradeCandidateMap = | 102 using UpgradeCandidateMap = |
| 98 HeapHashMap<AtomicString, Member<UpgradeCandidateSet>>; | 103 HeapHashMap<AtomicString, Member<UpgradeCandidateSet>>; |
| 99 Member<UpgradeCandidateMap> upgrade_candidates_; | 104 Member<UpgradeCandidateMap> upgrade_candidates_; |
| 100 | 105 |
| 101 using WhenDefinedPromiseMap = | 106 using WhenDefinedPromiseMap = |
| 102 HeapHashMap<AtomicString, Member<ScriptPromiseResolver>>; | 107 HeapHashMap<AtomicString, Member<ScriptPromiseResolver>>; |
| 103 WhenDefinedPromiseMap when_defined_promise_map_; | 108 WhenDefinedPromiseMap when_defined_promise_map_; |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace blink | 111 } // namespace blink |
| 107 | 112 |
| 108 #endif // CustomElementRegistry_h | 113 #endif // CustomElementRegistry_h |
| OLD | NEW |