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

Side by Side Diff: sky/engine/bindings/templates/interface.h

Issue 922053002: Remove unused V8 integration code in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6
7 #ifndef {{v8_class}}_h
8 #define {{v8_class}}_h
9
10 {% filter conditional(conditional_string) %}
11 {% for filename in header_includes %}
12 #include "{{filename}}"
13 {% endfor %}
14
15 namespace blink {
16
17 {% if has_event_constructor %}
18 class Dictionary;
19 {% endif %}
20 {% if named_constructor %}
21 class {{v8_class}}Constructor {
22 public:
23 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
24 static const WrapperTypeInfo wrapperTypeInfo;
25 };
26
27 {% endif %}
28 class {{v8_class}} {
29 public:
30 {% if has_private_script %}
31 class PrivateScript {
32 public:
33 {% for method in methods if method.is_implemented_in_private_script %}
34 static bool {{method.name}}Method({{method.argument_declarations_for_pri vate_script | join(', ')}});
35 {% endfor %}
36 {% for attribute in attributes if attribute.is_implemented_in_private_sc ript %}
37 static bool {{attribute.name}}AttributeGetter(LocalFrame* frame, {{cpp_c lass}}* holderImpl, {{attribute.cpp_type}}* result);
38 {% if not attribute.is_read_only %}
39 static bool {{attribute.name}}AttributeSetter(LocalFrame* frame, {{cpp_c lass}}* holderImpl, {{attribute.argument_cpp_type}} cppValue);
40 {% endif %}
41 {% endfor %}
42 };
43
44 {% endif %}
45 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
46 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va lue>, v8::Isolate*);
47 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
48 static {{cpp_class}}* toNative(v8::Handle<v8::Object> object)
49 {
50 return fromInternalPointer(blink::toScriptWrappableBase(object));
51 }
52 static {{cpp_class}}* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val ue>);
53 static const WrapperTypeInfo wrapperTypeInfo;
54 static void refObject(ScriptWrappableBase* internalPointer);
55 static void derefObject(ScriptWrappableBase* internalPointer);
56 {% if has_visit_dom_wrapper %}
57 static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8:: Persistent<v8::Object>&, v8::Isolate*);
58 {% endif %}
59 {% if is_active_dom_object %}
60 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
61 {% endif %}
62 {% if is_event_target %}
63 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
64 {% endif %}
65 {% if interface_name == 'Window' %}
66 static v8::Handle<v8::ObjectTemplate> getShadowObjectTemplate(v8::Isolate*);
67 {% endif %}
68 {% for method in methods %}
69 {% if method.is_custom %}
70 {% filter conditional(method.conditional_string) %}
71 static void {{method.name}}MethodCustom(const v8::FunctionCallbackInfo<v8::V alue>&);
72 {% endfilter %}
73 {% endif %}
74 {% endfor %}
75 {% if constructors or has_custom_constructor or has_event_constructor %}
76 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
77 {% endif %}
78 {% if has_custom_constructor %}
79 static void constructorCustom(const v8::FunctionCallbackInfo<v8::Value>&);
80 {% endif %}
81 {% for attribute in attributes %}
82 {% if attribute.has_custom_getter %}{# FIXME: and not attribute.implemented_ by #}
83 {% filter conditional(attribute.conditional_string) %}
84 static void {{attribute.name}}AttributeGetterCustom(const v8::PropertyCallba ckInfo<v8::Value>&);
85 {% endfilter %}
86 {% endif %}
87 {% if attribute.has_custom_setter %}{# FIXME: and not attribute.implemented_ by #}
88 {% filter conditional(attribute.conditional_string) %}
89 static void {{attribute.name}}AttributeSetterCustom(v8::Local<v8::Value>, co nst v8::PropertyCallbackInfo<void>&);
90 {% endfilter %}
91 {% endif %}
92 {% endfor %}
93 {# Custom special operations #}
94 {% if indexed_property_getter and indexed_property_getter.is_custom %}
95 static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallback Info<v8::Value>&);
96 {% endif %}
97 {% if indexed_property_setter and indexed_property_setter.is_custom %}
98 static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, cons t v8::PropertyCallbackInfo<v8::Value>&);
99 {% endif %}
100 {% if indexed_property_deleter and indexed_property_deleter.is_custom %}
101 static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbac kInfo<v8::Boolean>&);
102 {% endif %}
103 {% if named_property_getter and named_property_getter.is_custom %}
104 static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>&);
105 {% endif %}
106 {% if named_property_setter and named_property_setter.is_custom %}
107 static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::V alue>, const v8::PropertyCallbackInfo<v8::Value>&);
108 {% endif %}
109 {% if named_property_getter and
110 named_property_getter.is_custom_property_query %}
111 static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::Proper tyCallbackInfo<v8::Integer>&);
112 {% endif %}
113 {% if named_property_deleter and named_property_deleter.is_custom %}
114 static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Boolean>&);
115 {% endif %}
116 {% if named_property_getter and
117 named_property_getter.is_custom_property_enumerator %}
118 static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8: :Array>&);
119 {% endif %}
120 {# END custom special operations #}
121 {% if has_custom_legacy_call_as_function %}
122 static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&);
123 {% endif %}
124 {# Custom internal fields #}
125 {% set custom_internal_field_counter = 0 %}
126 {% if is_event_target and not is_node %}
127 {# Event listeners on DOM nodes are explicitly supported in the GC controlle r. #}
128 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCoun t + {{custom_internal_field_counter}};
129 {% set custom_internal_field_counter = custom_internal_field_counter + 1 %}
130 {% endif %}
131 {# persistentHandleIndex must be the last field, if it is present.
132 Detailed explanation: https://codereview.chromium.org/139173012
133 FIXME: Remove this internal field, and share one field for either:
134 * a persistent handle (if the object is in oilpan) or
135 * a C++ pointer to the DOM object (if the object is not in oilpan) #}
136 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + { {custom_internal_field_counter}};
137 {# End custom internal fields #}
138 static inline ScriptWrappableBase* toScriptWrappableBase({{cpp_class}}* impl )
139 {
140 return impl->toScriptWrappableBase();
141 }
142
143 static inline {{cpp_class}}* fromInternalPointer(ScriptWrappableBase* script Wrappable)
144 {
145 return scriptWrappable->toImpl<{{cpp_class}}>();
146 }
147 {% if interface_name == 'Window' %}
148 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
149 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
150 {% endif %}
151 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8 ::Isolate*){% if has_conditional_attributes %};
152 {% else %} { }
153 {% endif %}
154 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::I solate*){% if conditionally_enabled_methods %};
155 {% else %} { }
156 {% endif %}
157 {# Element wrappers #}
158 {% if interface_name == 'HTMLElement' %}
159 friend v8::Handle<v8::Object> createV8HTMLWrapper(HTMLElement*, v8::Handle<v 8::Object> creationContext, v8::Isolate*);
160 friend v8::Handle<v8::Object> createV8HTMLDirectWrapper(HTMLElement*, v8::Ha ndle<v8::Object> creationContext, v8::Isolate*);
161 friend v8::Handle<v8::Object> createV8HTMLFallbackWrapper(HTMLElement*, v8:: Handle<v8::Object> creationContext, v8::Isolate*);
162 {% elif interface_name == 'Element' %}
163 // This is a performance optimization hack. See V8Element::wrap.
164 friend v8::Handle<v8::Object> wrap(Node*, v8::Handle<v8::Object> creationCon text, v8::Isolate*);
165 {% endif %}
166
167 private:
168 {% if not has_custom_to_v8 %}
169 friend v8::Handle<v8::Object> wrap({{cpp_class}}*, v8::Handle<v8::Object> cr eationContext, v8::Isolate*);
170 static v8::Handle<v8::Object> createWrapper({{pass_cpp_type}}, v8::Handle<v8 ::Object> creationContext, v8::Isolate*);
171 {% endif %}
172 };
173
174 {% if has_custom_to_v8 %}
175 class {{cpp_class}};
176 v8::Handle<v8::Value> toV8({{cpp_class}}*, v8::Handle<v8::Object> creationContex t, v8::Isolate*);
177
178 template<class CallbackInfo>
179 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}* im pl)
180 {
181 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
182 }
183
184 template<class CallbackInfo>
185 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class}}* impl)
186 {
187 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate()));
188 }
189
190 template<class CallbackInfo, class Wrappable>
191 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class}} * impl, Wrappable*)
192 {
193 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate()));
194 }
195 {% else %}{# has_custom_to_v8 #}
196 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*);
197
198 inline v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
199 {
200 if (UNLIKELY(!impl))
201 return v8::Null(isolate);
202 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class}}>(impl, isolate);
203 if (!wrapper.IsEmpty())
204 return wrapper;
205
206 {% if is_script_wrappable %}
207 return impl->wrap(creationContext, isolate);
208 {% else %}
209 return wrap(impl, creationContext, isolate);
210 {% endif %}
211 }
212
213 template<typename CallbackInfo>
214 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}* im pl)
215 {
216 if (UNLIKELY(!impl)) {
217 v8SetReturnValueNull(callbackInfo);
218 return;
219 }
220 if (DOMDataStore::setReturnValueFromWrapper<{{v8_class}}>(callbackInfo.GetRe turnValue(), impl))
221 return;
222 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate());
223 v8SetReturnValue(callbackInfo, wrapper);
224 }
225
226 template<typename CallbackInfo>
227 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class}}* impl)
228 {
229 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
230 if (UNLIKELY(!impl)) {
231 v8SetReturnValueNull(callbackInfo);
232 return;
233 }
234 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<{{v8_class}}>(callba ckInfo.GetReturnValue(), impl))
235 return;
236 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate());
237 v8SetReturnValue(callbackInfo, wrapper);
238 }
239
240 template<class CallbackInfo, class Wrappable>
241 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class}} * impl, Wrappable* wrappable)
242 {
243 if (UNLIKELY(!impl)) {
244 v8SetReturnValueNull(callbackInfo);
245 return;
246 }
247 if (DOMDataStore::setReturnValueFromWrapperFast<{{v8_class}}>(callbackInfo.G etReturnValue(), impl, callbackInfo.Holder(), wrappable))
248 return;
249 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI nfo.GetIsolate());
250 v8SetReturnValue(callbackInfo, wrapper);
251 }
252 {% endif %}{# has_custom_to_v8 #}
253
254 inline v8::Handle<v8::Value> toV8({{pass_cpp_type}} impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
255 {
256 return toV8(impl.get(), creationContext, isolate);
257 }
258
259 template<class CallbackInfo>
260 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{pass_cpp_type}} impl)
261 {
262 v8SetReturnValue(callbackInfo, impl.get());
263 }
264
265 template<class CallbackInfo>
266 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{pas s_cpp_type}} impl)
267 {
268 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
269 }
270
271 template<class CallbackInfo, class Wrappable>
272 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{pass_cpp_ty pe}} impl, Wrappable* wrappable)
273 {
274 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
275 }
276
277 {% if has_event_constructor %}
278 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = "");
279
280 {% endif %}
281 } // namespace blink
282 {% endfilter %}
283 #endif // {{v8_class}}_h
OLDNEW
« no previous file with comments | « sky/engine/bindings/templates/dictionary_v8.cpp ('k') | sky/engine/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698