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 CustomElementDefinition_h | 5 #ifndef CustomElementDefinition_h |
| 6 #define CustomElementDefinition_h | 6 #define CustomElementDefinition_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" // For TraceWrapperBase | |
| 9 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 10 #include "core/dom/custom/CustomElementDescriptor.h" | 11 #include "core/dom/custom/CustomElementDescriptor.h" |
| 11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 12 #include "platform/wtf/HashSet.h" | 13 #include "platform/wtf/HashSet.h" |
| 13 #include "platform/wtf/Noncopyable.h" | 14 #include "platform/wtf/Noncopyable.h" |
| 14 #include "platform/wtf/text/AtomicString.h" | 15 #include "platform/wtf/text/AtomicString.h" |
| 15 #include "platform/wtf/text/AtomicStringHash.h" | 16 #include "platform/wtf/text/AtomicStringHash.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 class Document; | 20 class Document; |
| 20 class Element; | 21 class Element; |
| 21 class ExceptionState; | 22 class ExceptionState; |
| 22 class HTMLElement; | 23 class HTMLElement; |
| 23 class QualifiedName; | 24 class QualifiedName; |
| 24 | 25 |
| 25 class CORE_EXPORT CustomElementDefinition | 26 class CORE_EXPORT CustomElementDefinition |
| 26 : public GarbageCollectedFinalized<CustomElementDefinition> { | 27 : public GarbageCollectedFinalized<CustomElementDefinition>, |
| 28 public TraceWrapperBase { | |
|
Michael Lippautz
2017/04/19 08:49:12
I don't see why this one should be traced.
Trace
| |
| 27 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); | 29 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); |
| 28 | 30 |
| 29 public: | 31 public: |
| 32 // Each definition has an ID that is unique within the | |
| 33 // CustomElementRegistry that created it. | |
| 34 using Id = uint32_t; | |
| 35 | |
| 30 CustomElementDefinition(const CustomElementDescriptor&); | 36 CustomElementDefinition(const CustomElementDescriptor&); |
| 31 CustomElementDefinition(const CustomElementDescriptor&, | 37 CustomElementDefinition(const CustomElementDescriptor&, |
| 32 const HashSet<AtomicString>&); | 38 const HashSet<AtomicString>&); |
| 33 virtual ~CustomElementDefinition(); | 39 virtual ~CustomElementDefinition(); |
| 34 | 40 |
| 35 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
| 42 DECLARE_VIRTUAL_TRACE_WRAPPERS() {} | |
| 36 | 43 |
| 37 const CustomElementDescriptor& Descriptor() { return descriptor_; } | 44 const CustomElementDescriptor& Descriptor() { return descriptor_; } |
| 38 | 45 |
| 39 // TODO(yosin): To support Web Modules, introduce an abstract | |
| 40 // class |CustomElementConstructor| to allow us to have JavaScript | |
| 41 // and C++ constructors and ask the binding layer to convert | |
| 42 // |CustomElementConstructor| to |ScriptValue|. Replace | |
| 43 // |getConstructorForScript()| by |getConstructor() -> | |
| 44 // CustomElementConstructor|. | |
| 45 virtual ScriptValue GetConstructorForScript() = 0; | 46 virtual ScriptValue GetConstructorForScript() = 0; |
| 46 | 47 |
| 47 using ConstructionStack = HeapVector<Member<Element>, 1>; | 48 using ConstructionStack = HeapVector<Member<Element>, 1>; |
| 48 ConstructionStack& GetConstructionStack() { return construction_stack_; } | 49 ConstructionStack& GetConstructionStack() { return construction_stack_; } |
| 49 | 50 |
| 50 HTMLElement* CreateElementForConstructor(Document&); | 51 HTMLElement* CreateElementForConstructor(Document&); |
| 51 virtual HTMLElement* CreateElementSync(Document&, const QualifiedName&) = 0; | 52 virtual HTMLElement* CreateElementSync(Document&, const QualifiedName&) = 0; |
| 52 HTMLElement* CreateElementAsync(Document&, const QualifiedName&); | 53 HTMLElement* CreateElementAsync(Document&, const QualifiedName&); |
| 53 | 54 |
| 54 void Upgrade(Element*); | 55 void Upgrade(Element*); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 ConstructionStack construction_stack_; | 108 ConstructionStack construction_stack_; |
| 108 HashSet<AtomicString> observed_attributes_; | 109 HashSet<AtomicString> observed_attributes_; |
| 109 bool has_style_attribute_changed_callback_; | 110 bool has_style_attribute_changed_callback_; |
| 110 | 111 |
| 111 void EnqueueAttributeChangedCallbackForAllAttributes(Element*); | 112 void EnqueueAttributeChangedCallbackForAllAttributes(Element*); |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 } // namespace blink | 115 } // namespace blink |
| 115 | 116 |
| 116 #endif // CustomElementDefinition_h | 117 #endif // CustomElementDefinition_h |
| OLD | NEW |