Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h

Issue 2828643002: Make customElements.define faster
Patch Set: Try to make Android builder happy. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
9 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/TraceWrapperV8Reference.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
11 #include "core/dom/custom/CustomElementDefinition.h" 11 #include "core/dom/custom/CustomElementDefinition.h"
12 #include "platform/wtf/Noncopyable.h" 12 #include "platform/wtf/Noncopyable.h"
13 #include "platform/wtf/RefPtr.h" 13 #include "platform/wtf/RefPtr.h"
14 #include "v8.h" 14 #include "v8.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class CustomElementDescriptor; 18 class CustomElementDescriptor;
19 class CustomElementRegistry; 19 class CustomElementRegistry;
20 20
21 class CORE_EXPORT ScriptCustomElementDefinition final 21 class CORE_EXPORT ScriptCustomElementDefinition final
22 : public CustomElementDefinition { 22 : public CustomElementDefinition {
23 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition); 23 WTF_MAKE_NONCOPYABLE(ScriptCustomElementDefinition);
24 24
25 public: 25 public:
26 static ScriptCustomElementDefinition* ForConstructor( 26 static ScriptCustomElementDefinition* ForConstructor(
27 ScriptState*, 27 ScriptState*,
28 CustomElementRegistry*, 28 CustomElementRegistry*,
29 const v8::Local<v8::Value>& constructor); 29 const v8::Local<v8::Value>& constructor);
30 30
31 static ScriptCustomElementDefinition* Create( 31 static ScriptCustomElementDefinition* Create(
32 ScriptState*, 32 ScriptState*,
33 CustomElementRegistry*, 33 CustomElementRegistry*,
34 const CustomElementDescriptor&, 34 const CustomElementDescriptor&,
35 CustomElementDefinition::Id,
35 const v8::Local<v8::Object>& constructor, 36 const v8::Local<v8::Object>& constructor,
36 const v8::Local<v8::Function>& connected_callback, 37 const v8::Local<v8::Function>& connected_callback,
37 const v8::Local<v8::Function>& disconnected_callback, 38 const v8::Local<v8::Function>& disconnected_callback,
38 const v8::Local<v8::Function>& adopted_callback, 39 const v8::Local<v8::Function>& adopted_callback,
39 const v8::Local<v8::Function>& attribute_changed_callback, 40 const v8::Local<v8::Function>& attribute_changed_callback,
40 const HashSet<AtomicString>& observed_attributes); 41 const HashSet<AtomicString>& observed_attributes);
41 42
42 virtual ~ScriptCustomElementDefinition() = default; 43 virtual ~ScriptCustomElementDefinition() = default;
43 44
45 DECLARE_VIRTUAL_TRACE_WRAPPERS();
46
44 v8::Local<v8::Object> Constructor() const; 47 v8::Local<v8::Object> Constructor() const;
45 48
46 HTMLElement* CreateElementSync(Document&, const QualifiedName&) override; 49 HTMLElement* CreateElementSync(Document&, const QualifiedName&) override;
47 50
48 bool HasConnectedCallback() const override; 51 bool HasConnectedCallback() const override;
49 bool HasDisconnectedCallback() const override; 52 bool HasDisconnectedCallback() const override;
50 bool HasAdoptedCallback() const override; 53 bool HasAdoptedCallback() const override;
51 54
52 void RunConnectedCallback(Element*) override; 55 void RunConnectedCallback(Element*) override;
53 void RunDisconnectedCallback(Element*) override; 56 void RunDisconnectedCallback(Element*) override;
(...skipping 27 matching lines...) Expand all
81 Element*, 84 Element*,
82 int argc = 0, 85 int argc = 0,
83 v8::Local<v8::Value> argv[] = nullptr); 86 v8::Local<v8::Value> argv[] = nullptr);
84 87
85 HTMLElement* HandleCreateElementSyncException(Document&, 88 HTMLElement* HandleCreateElementSyncException(Document&,
86 const QualifiedName& tag_name, 89 const QualifiedName& tag_name,
87 v8::Isolate*, 90 v8::Isolate*,
88 ExceptionState&); 91 ExceptionState&);
89 92
90 RefPtr<ScriptState> script_state_; 93 RefPtr<ScriptState> script_state_;
91 ScopedPersistent<v8::Object> constructor_; 94 // TODO(dominicc): Change these to Object, Function respectively
92 ScopedPersistent<v8::Function> connected_callback_; 95 // when TraceWrappers supports more than just v8::Value.
93 ScopedPersistent<v8::Function> disconnected_callback_; 96 TraceWrapperV8Reference<v8::Value> constructor_;
Michael Lippautz 2017/04/19 08:49:12 The intention of the template was that you can kee
94 ScopedPersistent<v8::Function> adopted_callback_; 97 TraceWrapperV8Reference<v8::Value> connected_callback_;
95 ScopedPersistent<v8::Function> attribute_changed_callback_; 98 TraceWrapperV8Reference<v8::Value> disconnected_callback_;
99 TraceWrapperV8Reference<v8::Value> adopted_callback_;
100 TraceWrapperV8Reference<v8::Value> attribute_changed_callback_;
96 }; 101 };
97 102
98 } // namespace blink 103 } // namespace blink
99 104
100 #endif // ScriptCustomElementDefinition_h 105 #endif // ScriptCustomElementDefinition_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698