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 ScriptCustomElementDefinitionBuilder_h | 5 #ifndef ScriptCustomElementDefinitionBuilder_h |
6 #define ScriptCustomElementDefinitionBuilder_h | 6 #define ScriptCustomElementDefinitionBuilder_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/custom/CustomElementDefinitionBuilder.h" | 9 #include "core/dom/custom/CustomElementDefinitionBuilder.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "v8.h" | 11 #include "v8.h" |
12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
13 #include "wtf/HashSet.h" | 13 #include "wtf/HashSet.h" |
14 #include "wtf/Noncopyable.h" | 14 #include "wtf/Noncopyable.h" |
15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
16 #include "wtf/text/AtomicString.h" | 16 #include "wtf/text/AtomicString.h" |
17 #include "wtf/text/AtomicStringHash.h" | 17 #include "wtf/text/AtomicStringHash.h" |
18 #include "wtf/text/StringView.h" | 18 #include "wtf/text/StringView.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class CustomElementsRegistry; | 22 class CustomElementRegistry; |
23 class ExceptionState; | 23 class ExceptionState; |
24 class ScriptState; | 24 class ScriptState; |
25 class ScriptValue; | 25 class ScriptValue; |
26 | 26 |
27 class CORE_EXPORT ScriptCustomElementDefinitionBuilder | 27 class CORE_EXPORT ScriptCustomElementDefinitionBuilder |
28 : public CustomElementDefinitionBuilder { | 28 : public CustomElementDefinitionBuilder { |
29 STACK_ALLOCATED(); | 29 STACK_ALLOCATED(); |
30 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinitionBuilder); | 30 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinitionBuilder); |
31 public: | 31 public: |
32 ScriptCustomElementDefinitionBuilder( | 32 ScriptCustomElementDefinitionBuilder( |
33 ScriptState*, | 33 ScriptState*, |
34 CustomElementsRegistry*, | 34 CustomElementRegistry*, |
35 const ScriptValue& constructorScriptValue, | 35 const ScriptValue& constructorScriptValue, |
36 ExceptionState&); | 36 ExceptionState&); |
37 ~ScriptCustomElementDefinitionBuilder(); | 37 ~ScriptCustomElementDefinitionBuilder(); |
38 | 38 |
39 bool checkConstructorIntrinsics() override; | 39 bool checkConstructorIntrinsics() override; |
40 bool checkConstructorNotRegistered() override; | 40 bool checkConstructorNotRegistered() override; |
41 bool checkPrototype() override; | 41 bool checkPrototype() override; |
42 bool rememberOriginalProperties() override; | 42 bool rememberOriginalProperties() override; |
43 CustomElementDefinition* build(const CustomElementDescriptor&) override; | 43 CustomElementDefinition* build(const CustomElementDescriptor&) override; |
44 | 44 |
45 private: | 45 private: |
46 static ScriptCustomElementDefinitionBuilder* s_stack; | 46 static ScriptCustomElementDefinitionBuilder* s_stack; |
47 | 47 |
48 ScriptCustomElementDefinitionBuilder* m_prev; | 48 ScriptCustomElementDefinitionBuilder* m_prev; |
49 RefPtr<ScriptState> m_scriptState; | 49 RefPtr<ScriptState> m_scriptState; |
50 Member<CustomElementsRegistry> m_registry; | 50 Member<CustomElementRegistry> m_registry; |
51 v8::Local<v8::Value> m_constructorValue; | 51 v8::Local<v8::Value> m_constructorValue; |
52 v8::Local<v8::Object> m_constructor; | 52 v8::Local<v8::Object> m_constructor; |
53 v8::Local<v8::Object> m_prototype; | 53 v8::Local<v8::Object> m_prototype; |
54 v8::Local<v8::Function> m_connectedCallback; | 54 v8::Local<v8::Function> m_connectedCallback; |
55 v8::Local<v8::Function> m_disconnectedCallback; | 55 v8::Local<v8::Function> m_disconnectedCallback; |
56 v8::Local<v8::Function> m_adoptedCallback; | 56 v8::Local<v8::Function> m_adoptedCallback; |
57 v8::Local<v8::Function> m_attributeChangedCallback; | 57 v8::Local<v8::Function> m_attributeChangedCallback; |
58 HashSet<AtomicString> m_observedAttributes; | 58 HashSet<AtomicString> m_observedAttributes; |
59 ExceptionState& m_exceptionState; | 59 ExceptionState& m_exceptionState; |
60 | 60 |
61 bool valueForName(const v8::Local<v8::Object>&, const StringView&, v8::Local
<v8::Value>&) const; | 61 bool valueForName(const v8::Local<v8::Object>&, const StringView&, v8::Local
<v8::Value>&) const; |
62 bool callableForName(const StringView&, v8::Local<v8::Function>&) const; | 62 bool callableForName(const StringView&, v8::Local<v8::Function>&) const; |
63 bool retrieveObservedAttributes(); | 63 bool retrieveObservedAttributes(); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
67 | 67 |
68 #endif // ScriptCustomElementDefinitionBuilder_h | 68 #endif // ScriptCustomElementDefinitionBuilder_h |
OLD | NEW |