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 ScriptCustomElementDefinition_h | 5 #ifndef ScriptCustomElementDefinition_h |
6 #define ScriptCustomElementDefinition_h | 6 #define ScriptCustomElementDefinition_h |
7 | 7 |
8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptState.h" |
9 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
10 #include "core/dom/custom/CustomElementDefinition.h" | 11 #include "core/dom/custom/CustomElementDefinition.h" |
11 #include "v8.h" | 12 #include "v8.h" |
12 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/RefPtr.h" |
13 | 15 |
14 namespace blink { | 16 namespace blink { |
15 | 17 |
16 class CustomElementDescriptor; | 18 class CustomElementDescriptor; |
17 class CustomElementsRegistry; | 19 class CustomElementsRegistry; |
18 class ScriptState; | |
19 | 20 |
20 class CORE_EXPORT ScriptCustomElementDefinition final : | 21 class CORE_EXPORT ScriptCustomElementDefinition final : |
21 public CustomElementDefinition { | 22 public CustomElementDefinition { |
22 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); | 23 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); |
23 public: | 24 public: |
24 static ScriptCustomElementDefinition* forConstructor( | 25 static ScriptCustomElementDefinition* forConstructor( |
25 ScriptState*, | 26 ScriptState*, |
26 CustomElementsRegistry*, | 27 CustomElementsRegistry*, |
27 const v8::Local<v8::Value>& constructor); | 28 const v8::Local<v8::Value>& constructor); |
28 | 29 |
29 static ScriptCustomElementDefinition* create( | 30 static ScriptCustomElementDefinition* create( |
30 ScriptState*, | 31 ScriptState*, |
31 CustomElementsRegistry*, | 32 CustomElementsRegistry*, |
32 const CustomElementDescriptor&, | 33 const CustomElementDescriptor&, |
33 const v8::Local<v8::Object>& constructor, | 34 const v8::Local<v8::Object>& constructor, |
34 const v8::Local<v8::Object>& prototype); | 35 const v8::Local<v8::Object>& prototype); |
35 | 36 |
| 37 virtual ~ScriptCustomElementDefinition() = default; |
| 38 |
| 39 // TODO(dominicc): Move this to a command object suitable for a |
| 40 // reaction queue. |
| 41 bool upgrade(Element*) override; |
| 42 |
36 v8::Local<v8::Object> constructor(ScriptState*) const; | 43 v8::Local<v8::Object> constructor(ScriptState*) const; |
37 v8::Local<v8::Object> prototype(ScriptState*) const; | 44 v8::Local<v8::Object> prototype(ScriptState*) const; |
38 | 45 |
39 private: | 46 private: |
40 ScriptCustomElementDefinition( | 47 ScriptCustomElementDefinition( |
41 ScriptState*, | 48 ScriptState*, |
42 const CustomElementDescriptor&, | 49 const CustomElementDescriptor&, |
43 const v8::Local<v8::Object>& constructor, | 50 const v8::Local<v8::Object>& constructor, |
44 const v8::Local<v8::Object>& prototype); | 51 const v8::Local<v8::Object>& prototype); |
45 | 52 |
| 53 RefPtr<ScriptState> m_scriptState; |
46 ScopedPersistent<v8::Object> m_constructor; | 54 ScopedPersistent<v8::Object> m_constructor; |
47 ScopedPersistent<v8::Object> m_prototype; | 55 ScopedPersistent<v8::Object> m_prototype; |
48 }; | 56 }; |
49 | 57 |
50 } // namespace blink | 58 } // namespace blink |
51 | 59 |
52 #endif // ScriptCustomElementDefinition_h | 60 #endif // ScriptCustomElementDefinition_h |
OLD | NEW |