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 "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/dom/custom/CustomElementDescriptor.h" | 10 #include "core/dom/custom/CustomElementDescriptor.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ScriptState; | 16 class ScriptState; |
| 17 class Element; |
17 | 18 |
18 class CORE_EXPORT CustomElementDefinition | 19 class CORE_EXPORT CustomElementDefinition |
19 : public GarbageCollectedFinalized<CustomElementDefinition> { | 20 : public GarbageCollectedFinalized<CustomElementDefinition> { |
20 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); | 21 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); |
21 public: | 22 public: |
22 CustomElementDefinition(const CustomElementDescriptor&); | 23 CustomElementDefinition(const CustomElementDescriptor&); |
23 virtual ~CustomElementDefinition(); | 24 virtual ~CustomElementDefinition(); |
24 | 25 |
| 26 DECLARE_VIRTUAL_TRACE(); |
| 27 |
25 const CustomElementDescriptor& descriptor() { return m_descriptor; } | 28 const CustomElementDescriptor& descriptor() { return m_descriptor; } |
26 | 29 |
27 // TODO(yosin): To support Web Module, once we introduce abstract class | 30 // TODO(yosin): To support Web Modules, introduce an abstract |
28 // |CustomElementConstructor|, allows us to have JavaScript and C++ | 31 // class |CustomElementConstructor| to allow us to have JavaScript |
29 // constructor, and ask binding layer to convert |CustomElementConstructor| | 32 // and C++ constructors and ask the binding layer to convert |
30 // to |ScriptValue|, we should replace |getConstructorForScript()| by | 33 // |CustomElementConstructor| to |ScriptValue|. Replace |
31 // |getConstructor() -> CustomElementConstructor|. | 34 // |getConstructorForScript()| by |getConstructor() -> |
| 35 // CustomElementConstructor|. |
32 virtual ScriptValue getConstructorForScript() = 0; | 36 virtual ScriptValue getConstructorForScript() = 0; |
33 | 37 |
34 DEFINE_INLINE_VIRTUAL_TRACE() { } | 38 using ConstructionStack = HeapVector<Member<Element>, 1>; |
| 39 ConstructionStack& constructionStack() |
| 40 { |
| 41 return m_constructionStack; |
| 42 } |
| 43 |
| 44 void upgrade(Element*); |
| 45 |
| 46 protected: |
| 47 // TODO(dominicc): Make this pure virtual when the script side is |
| 48 // implemented. |
| 49 virtual bool runConstructor(Element*); |
35 | 50 |
36 private: | 51 private: |
37 const CustomElementDescriptor m_descriptor; | 52 const CustomElementDescriptor m_descriptor; |
| 53 ConstructionStack m_constructionStack; |
38 }; | 54 }; |
39 | 55 |
40 } // namespace blink | 56 } // namespace blink |
41 | 57 |
42 #endif // CustomElementDefinition_h | 58 #endif // CustomElementDefinition_h |
OLD | NEW |