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 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 "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/custom/CustomElementDefinition.h" | 10 #include "core/dom/custom/CustomElementDefinition.h" |
| 11 #include "v8.h" | 11 #include "v8.h" |
| 12 #include "wtf/HashSet.h" | |
| 12 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/text/AtomicString.h" | |
| 15 #include "wtf/text/AtomicStringHash.h" | |
| 13 | 16 |
| 14 namespace blink { | 17 namespace blink { |
| 15 | 18 |
| 16 class CustomElementDescriptor; | 19 class CustomElementDescriptor; |
| 17 class CustomElementsRegistry; | 20 class CustomElementsRegistry; |
| 18 class ScriptState; | 21 class ScriptState; |
| 19 | 22 |
| 20 class CORE_EXPORT ScriptCustomElementDefinition final : | 23 class CORE_EXPORT ScriptCustomElementDefinition final : |
| 21 public CustomElementDefinition { | 24 public CustomElementDefinition { |
| 22 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); | 25 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); |
| 23 public: | 26 public: |
| 24 static ScriptCustomElementDefinition* forConstructor( | 27 static ScriptCustomElementDefinition* forConstructor( |
| 25 ScriptState*, | 28 ScriptState*, |
| 26 CustomElementsRegistry*, | 29 CustomElementsRegistry*, |
| 27 const v8::Local<v8::Value>& constructor); | 30 const v8::Local<v8::Value>& constructor); |
| 28 | 31 |
| 29 static ScriptCustomElementDefinition* create( | 32 static ScriptCustomElementDefinition* create( |
| 30 ScriptState*, | 33 ScriptState*, |
| 31 CustomElementsRegistry*, | 34 CustomElementsRegistry*, |
| 32 const CustomElementDescriptor&, | 35 const CustomElementDescriptor&, |
| 33 const v8::Local<v8::Object>& constructor, | 36 const v8::Local<v8::Object>& constructor, |
|
yosin_UTC9
2016/06/01 06:33:33
Can we have struct ScriptCustomElementDefinitionIn
kojii
2016/06/01 07:19:27
I think it's too much complex, when we have Script
kojii
2016/06/01 13:49:10
I made ScriptCustomElementDefinitionBuilder friend
| |
| 34 const v8::Local<v8::Object>& prototype); | 37 const v8::Local<v8::Object>& prototype, |
| 38 const v8::Local<v8::Object>& connectedCallback, | |
| 39 const v8::Local<v8::Object>& disconnectedCallback, | |
| 40 const v8::Local<v8::Object>& attributeChangedCallback, | |
| 41 const Vector<AtomicString>& observedAttributes); | |
| 35 | 42 |
| 36 virtual ~ScriptCustomElementDefinition() = default; | 43 virtual ~ScriptCustomElementDefinition() = default; |
| 37 | 44 |
| 38 v8::Local<v8::Object> constructor(ScriptState*) const; | 45 v8::Local<v8::Object> constructor(ScriptState*) const; |
| 39 v8::Local<v8::Object> prototype(ScriptState*) const; | 46 v8::Local<v8::Object> prototype(ScriptState*) const; |
| 40 | 47 |
| 41 private: | 48 private: |
| 42 ScriptCustomElementDefinition( | 49 ScriptCustomElementDefinition( |
| 43 ScriptState*, | 50 ScriptState*, |
| 44 const CustomElementDescriptor&, | 51 const CustomElementDescriptor&, |
| 45 const v8::Local<v8::Object>& constructor, | 52 const v8::Local<v8::Object>& constructor, |
| 46 const v8::Local<v8::Object>& prototype); | 53 const v8::Local<v8::Object>& prototype, |
| 54 const v8::Local<v8::Object>& connectedCallback, | |
|
yosin_UTC9
2016/06/01 06:33:33
FYI, since v8::Local<T> is just T*, pass by value
kojii
2016/06/01 07:19:27
I can do that, but Set and many v8 functions recei
| |
| 55 const v8::Local<v8::Object>& disconnectedCallback, | |
| 56 const v8::Local<v8::Object>& attributeChangedCallback, | |
| 57 const Vector<AtomicString>& observedAttributes); | |
| 47 | 58 |
| 48 ScopedPersistent<v8::Object> m_constructor; | 59 ScopedPersistent<v8::Object> m_constructor; |
| 49 ScopedPersistent<v8::Object> m_prototype; | 60 ScopedPersistent<v8::Object> m_prototype; |
| 61 ScopedPersistent<v8::Object> m_connectedCallback; | |
| 62 ScopedPersistent<v8::Object> m_disconnectedCallback; | |
| 63 ScopedPersistent<v8::Object> m_attributeChangedCallback; | |
| 64 HashSet<AtomicString> m_observedAttributes; | |
| 50 }; | 65 }; |
| 51 | 66 |
| 52 } // namespace blink | 67 } // namespace blink |
| 53 | 68 |
| 54 #endif // ScriptCustomElementDefinition_h | 69 #endif // ScriptCustomElementDefinition_h |
| OLD | NEW |