OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! | 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 {% filter conditional(conditional_string) %} | 8 {% filter conditional(conditional_string) %} |
9 #include "{{v8_class}}.h" | 9 #include "{{v8_class_or_partial}}.h" |
10 | 10 |
11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} | 11 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
12 #include "{{filename}}" | 12 #include "{{filename}}" |
13 {% endfor %} | 13 {% endfor %} |
14 | 14 |
| 15 {% block initialize_script_wrappable %}{% endblock %} |
15 namespace blink { | 16 namespace blink { |
16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class | 17 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class |
17 if is_active_dom_object else '0' %} | 18 if is_active_dom_object else '0' %} |
18 {% set to_event_target = '%s::toEventTarget' % v8_class | 19 {% set to_event_target = '%s::toEventTarget' % v8_class |
19 if is_event_target else '0' %} | 20 if is_event_target else '0' %} |
20 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class | 21 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class |
21 if has_visit_dom_wrapper else '0' %} | 22 if has_visit_dom_wrapper else '0' %} |
22 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface | 23 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface |
23 if parent_interface else '0' %} | 24 if parent_interface else '0' %} |
24 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception
else | 25 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception
else |
25 'WrapperTypeObjectPrototype' %} | 26 'WrapperTypeObjectPrototype' %} |
26 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie
w else '0' %} | 27 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie
w else '0' %} |
27 | 28 |
28 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{d
om_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}:
:trace, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{
v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditional
lyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_ty
pe_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifeti
me}}, WrapperTypeInfo::{{gc_type}} }; | 29 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} |
| 30 {% if not is_partial %} |
| 31 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin
::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::deref
Object, {{v8_class}}::trace, {{to_active_dom_object}}, {{to_event_target}}, {{vi
sit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}
}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperT
ypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, Wrap
perTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; |
29 | 32 |
30 {% if is_script_wrappable %} | 33 {% if is_script_wrappable %} |
31 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}
}.h. | 34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}
}.h. |
32 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
33 // bindings/core/v8/ScriptWrappable.h. | 36 // bindings/core/v8/ScriptWrappable.h. |
34 {% if is_typed_array_type %} | 37 {% if is_typed_array_type %} |
35 template<> | 38 template<> |
36 {% endif %} | 39 {% endif %} |
37 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT
ypeInfo; | 40 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT
ypeInfo; |
38 | 41 |
39 {% endif %} | 42 {% endif %} |
| 43 {% endif %} |
40 {% if not is_array_buffer_or_view %} | 44 {% if not is_array_buffer_or_view %} |
41 namespace {{cpp_class}}V8Internal { | 45 namespace {{cpp_class_or_partial}}V8Internal { |
| 46 {% if has_partial_interface %} |
| 47 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 48 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba
ckInfo<v8::Value>&) = 0; |
| 49 {% endfor %} |
| 50 {% endif %} |
42 | 51 |
43 {# Constants #} | 52 {# Constants #} |
44 {% from 'constants.cpp' import constant_getter_callback | 53 {% from 'constants.cpp' import constant_getter_callback |
45 with context %} | 54 with context %} |
46 {% for constant in special_getter_constants %} | 55 {% for constant in special_getter_constants %} |
47 {{constant_getter_callback(constant)}} | 56 {{constant_getter_callback(constant)}} |
48 {% endfor %} | 57 {% endfor %} |
49 {# Attributes #} | 58 {# Attributes #} |
50 {% from 'attributes.cpp' import constructor_getter_callback, | 59 {% from 'attributes.cpp' import constructor_getter_callback, |
51 attribute_getter, attribute_getter_callback, | 60 attribute_getter, attribute_getter_callback, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 exceptionState.throwIfNeeded(); | 112 exceptionState.throwIfNeeded(); |
104 return; | 113 return; |
105 } | 114 } |
106 {% endif %} | 115 {% endif %} |
107 if (info.This()->IsObject()) | 116 if (info.This()->IsObject()) |
108 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | 117 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
109 } | 118 } |
110 | 119 |
111 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n
ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 120 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n
ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
112 { | 121 { |
113 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value,
info); | 122 {{cpp_class_or_partial}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(nam
e, v8Value, info); |
114 } | 123 } |
115 | 124 |
116 {% endif %} | 125 {% endif %} |
117 {% endblock %} | 126 {% endblock %} |
118 {##############################################################################} | 127 {##############################################################################} |
119 {% block security_check_functions %} | 128 {% block security_check_functions %} |
120 {% if has_access_check_callbacks %} | 129 {% if has_access_check_callbacks %} |
121 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) | 130 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) |
122 { | 131 { |
123 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | 132 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); |
(...skipping 10 matching lines...) Expand all Loading... |
134 {% endblock %} | 143 {% endblock %} |
135 {##############################################################################} | 144 {##############################################################################} |
136 {# Methods #} | 145 {# Methods #} |
137 {% from 'methods.cpp' import generate_method, overload_resolution_method, | 146 {% from 'methods.cpp' import generate_method, overload_resolution_method, |
138 method_callback, origin_safe_method_getter, generate_constructor, | 147 method_callback, origin_safe_method_getter, generate_constructor, |
139 method_implemented_in_private_script | 148 method_implemented_in_private_script |
140 with context %} | 149 with context %} |
141 {% for method in methods %} | 150 {% for method in methods %} |
142 {% if method.should_be_exposed_to_script %} | 151 {% if method.should_be_exposed_to_script %} |
143 {% for world_suffix in method.world_suffixes %} | 152 {% for world_suffix in method.world_suffixes %} |
144 {% if not method.is_custom %} | 153 {% if not method.is_custom and method.visible %} |
145 {{generate_method(method, world_suffix)}} | 154 {{generate_method(method, world_suffix)}} |
146 {% endif %} | 155 {% endif %} |
147 {% if method.overloads %} | 156 {% if method.overloads and method.overloads.visible %} |
148 {{overload_resolution_method(method.overloads, world_suffix)}} | 157 {{overload_resolution_method(method.overloads, world_suffix)}} |
149 {% endif %} | 158 {% endif %} |
150 {% if not method.overload_index or method.overloads %} | 159 {% if not method.overload_index or method.overloads %} |
| 160 {# Document about the following condition: #} |
| 161 {# https://docs.google.com/document/d/1qBC7Therp437Jbt_QYAtNYMZs6zQ_7_tnMkNUG_AC
qs/edit?usp=sharing #} |
| 162 {% if (method.overloads and method.overloads.visible and |
| 163 (not method.overloads.has_partial_overloads or not is_partial)) or |
| 164 (not method.overloads and method.visible) %} |
151 {# A single callback is generated for overloaded methods #} | 165 {# A single callback is generated for overloaded methods #} |
| 166 {# with considering partial overloads #} |
152 {{method_callback(method, world_suffix)}} | 167 {{method_callback(method, world_suffix)}} |
153 {% endif %} | 168 {% endif %} |
154 {% if method.is_do_not_check_security %} | 169 {% endif %} |
| 170 {% if method.is_do_not_check_security and method.visible %} |
155 {{origin_safe_method_getter(method, world_suffix)}} | 171 {{origin_safe_method_getter(method, world_suffix)}} |
156 {% endif %} | 172 {% endif %} |
157 {% endfor %} | 173 {% endfor %} |
158 {% endif %} | 174 {% endif %} |
159 {% endfor %} | 175 {% endfor %} |
160 {% if iterator_method %} | 176 {% if iterator_method %} |
161 {{generate_method(iterator_method)}} | 177 {{generate_method(iterator_method)}} |
162 {{method_callback(iterator_method)}} | 178 {{method_callback(iterator_method)}} |
163 {% endif %} | 179 {% endif %} |
164 {% block origin_safe_method_setter %}{% endblock %} | 180 {% block origin_safe_method_setter %}{% endblock %} |
(...skipping 13 matching lines...) Expand all Loading... |
178 {% block named_property_getter %}{% endblock %} | 194 {% block named_property_getter %}{% endblock %} |
179 {% block named_property_getter_callback %}{% endblock %} | 195 {% block named_property_getter_callback %}{% endblock %} |
180 {% block named_property_setter %}{% endblock %} | 196 {% block named_property_setter %}{% endblock %} |
181 {% block named_property_setter_callback %}{% endblock %} | 197 {% block named_property_setter_callback %}{% endblock %} |
182 {% block named_property_query %}{% endblock %} | 198 {% block named_property_query %}{% endblock %} |
183 {% block named_property_query_callback %}{% endblock %} | 199 {% block named_property_query_callback %}{% endblock %} |
184 {% block named_property_deleter %}{% endblock %} | 200 {% block named_property_deleter %}{% endblock %} |
185 {% block named_property_deleter_callback %}{% endblock %} | 201 {% block named_property_deleter_callback %}{% endblock %} |
186 {% block named_property_enumerator %}{% endblock %} | 202 {% block named_property_enumerator %}{% endblock %} |
187 {% block named_property_enumerator_callback %}{% endblock %} | 203 {% block named_property_enumerator_callback %}{% endblock %} |
188 } // namespace {{cpp_class}}V8Internal | 204 } // namespace {{cpp_class_or_partial}}V8Internal |
189 | 205 |
190 {% block visit_dom_wrapper %}{% endblock %} | 206 {% block visit_dom_wrapper %}{% endblock %} |
191 {% block shadow_attributes %}{% endblock %} | 207 {% block shadow_attributes %}{% endblock %} |
192 {##############################################################################} | 208 {##############################################################################} |
193 {% block install_attributes %} | 209 {% block install_attributes %} |
| 210 {% from 'attributes.cpp' import attribute_configuration with context %} |
194 {% if has_attribute_configuration %} | 211 {% if has_attribute_configuration %} |
195 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[]
= { | 212 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[]
= { |
196 {% for attribute in attributes | 213 {% for attribute in attributes |
197 if not (attribute.is_expose_js_accessors or | 214 if not (attribute.is_expose_js_accessors or |
198 attribute.is_static or | 215 attribute.is_static or |
199 attribute.runtime_enabled_function or | 216 attribute.runtime_enabled_function or |
200 attribute.per_context_enabled_function or | 217 attribute.per_context_enabled_function or |
201 attribute.exposed_test or | 218 attribute.exposed_test or |
202 (interface_name == 'Window' and attribute.is_unforgeable)) | 219 (interface_name == 'Window' and attribute.is_unforgeable)) |
203 and attribute.should_be_exposed_to_script %} | 220 and attribute.should_be_exposed_to_script %} |
204 {% filter conditional(attribute.conditional_string) %} | 221 {% filter conditional(attribute.conditional_string) %} |
205 {{attribute_configuration(attribute)}}, | 222 {{attribute_configuration(attribute)}}, |
206 {% endfilter %} | 223 {% endfilter %} |
207 {% endfor %} | 224 {% endfor %} |
208 }; | 225 }; |
209 | 226 |
210 {% endif %} | 227 {% endif %} |
211 {% endblock %} | 228 {% endblock %} |
212 {##############################################################################} | 229 {##############################################################################} |
213 {% block install_accessors %} | 230 {% block install_accessors %} |
| 231 {% from 'attributes.cpp' import attribute_configuration with context %} |
214 {% if has_accessors %} | 232 {% if has_accessors %} |
215 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] =
{ | 233 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] =
{ |
216 {% for attribute in attributes if attribute.is_expose_js_accessors and attri
bute.should_be_exposed_to_script %} | 234 {% for attribute in attributes if attribute.is_expose_js_accessors and attri
bute.should_be_exposed_to_script %} |
217 {{attribute_configuration(attribute)}}, | 235 {{attribute_configuration(attribute)}}, |
218 {% endfor %} | 236 {% endfor %} |
219 }; | 237 }; |
220 | 238 |
221 {% endif %} | 239 {% endif %} |
222 {% endblock %} | 240 {% endblock %} |
223 {##############################################################################} | 241 {##############################################################################} |
(...skipping 13 matching lines...) Expand all Loading... |
237 {% endif %}{# not is_array_buffer_or_view #} | 255 {% endif %}{# not is_array_buffer_or_view #} |
238 {##############################################################################} | 256 {##############################################################################} |
239 {% block named_constructor %}{% endblock %} | 257 {% block named_constructor %}{% endblock %} |
240 {% block initialize_event %}{% endblock %} | 258 {% block initialize_event %}{% endblock %} |
241 {% block constructor_callback %}{% endblock %} | 259 {% block constructor_callback %}{% endblock %} |
242 {% block configure_shadow_object_template %}{% endblock %} | 260 {% block configure_shadow_object_template %}{% endblock %} |
243 {##############################################################################} | 261 {##############################################################################} |
244 {% block install_dom_template %} | 262 {% block install_dom_template %} |
245 {% if not is_array_buffer_or_view %} | 263 {% if not is_array_buffer_or_view %} |
246 {% from 'methods.cpp' import install_custom_signature with context %} | 264 {% from 'methods.cpp' import install_custom_signature with context %} |
| 265 {% from 'attributes.cpp' import attribute_configuration with context %} |
247 {% from 'constants.cpp' import install_constants with context %} | 266 {% from 'constants.cpp' import install_constants with context %} |
| 267 {% if has_partial_interface or is_partial %} |
| 268 void {{v8_class_or_partial}}::install{{v8_class}}Template(v8::Handle<v8::Functio
nTemplate> functionTemplate, v8::Isolate* isolate) |
| 269 {% else %} |
248 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
nTemplate, v8::Isolate* isolate) | 270 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
nTemplate, v8::Isolate* isolate) |
| 271 {% endif %} |
249 { | 272 { |
| 273 {% if is_partial %} |
| 274 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate); |
| 275 {% else %} |
250 functionTemplate->ReadOnlyPrototype(); | 276 functionTemplate->ReadOnlyPrototype(); |
| 277 {% endif %} |
251 | 278 |
252 v8::Local<v8::Signature> defaultSignature; | 279 v8::Local<v8::Signature> defaultSignature; |
253 {% set parent_template = | 280 {% set parent_template = |
254 'V8%s::domTemplate(isolate)' % parent_interface | 281 'V8%s::domTemplate(isolate)' % parent_interface |
255 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} | 282 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} |
256 {% if runtime_enabled_function %} | 283 {% if runtime_enabled_function %} |
257 if (!{{runtime_enabled_function}}()) | 284 if (!{{runtime_enabled_function}}()) |
258 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT
emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0,
0, 0, isolate); | 285 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT
emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0,
0, 0, isolate); |
259 else | 286 else |
260 {% endif %} | 287 {% endif %} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ | 333 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu
ration =\ |
307 {{attribute_configuration(attribute)}}; | 334 {{attribute_configuration(attribute)}}; |
308 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); | 335 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate
, attributeConfiguration, isolate); |
309 } | 336 } |
310 {% endfilter %} | 337 {% endfilter %} |
311 {% endfor %} | 338 {% endfor %} |
312 {% if constants %} | 339 {% if constants %} |
313 {{install_constants() | indent}} | 340 {{install_constants() | indent}} |
314 {% endif %} | 341 {% endif %} |
315 {# Special operations #} | 342 {# Special operations #} |
316 {# V8 has access-check callback API and it is used on Window instead of | 343 {# V8 has access-check callback API and it\'s used on Window instead of |
317 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. | 344 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. |
318 In addition, the getter should be set on the prototype template, to get | 345 In addition, the getter should be set on the prototype template, to get |
319 the implementation straight out of the Window prototype, regardless of | 346 the implementation straight out of the Window prototype, regardless of |
320 what prototype is actually set on the object. #} | 347 what prototype is actually set on the object. #} |
321 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' | 348 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' |
322 else 'InstanceTemplate' %} | 349 else 'InstanceTemplate' %} |
323 {% if indexed_property_getter %} | 350 {% if indexed_property_getter %} |
324 {# if have indexed properties, MUST have an indexed property getter #} | 351 {# if have indexed properties, MUST have an indexed property getter #} |
325 {% set indexed_property_getter_callback = | 352 {% set indexed_property_getter_callback = |
326 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} | 353 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} |
(...skipping 21 matching lines...) Expand all Loading... |
348 if named_property_getter.is_enumerable else '0' %} | 375 if named_property_getter.is_enumerable else '0' %} |
349 {% set named_property_deleter_callback = | 376 {% set named_property_deleter_callback = |
350 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class | 377 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class |
351 if named_property_deleter else '0' %} | 378 if named_property_deleter else '0' %} |
352 {% set named_property_enumerator_callback = | 379 {% set named_property_enumerator_callback = |
353 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class | 380 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class |
354 if named_property_getter.is_enumerable else '0' %} | 381 if named_property_getter.is_enumerable else '0' %} |
355 functionTemplate->{{set_on_template}}()->SetNamedPropertyHandler({{named_pro
perty_getter_callback}}, {{named_property_setter_callback}}, {{named_property_qu
ery_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator
_callback}}); | 382 functionTemplate->{{set_on_template}}()->SetNamedPropertyHandler({{named_pro
perty_getter_callback}}, {{named_property_setter_callback}}, {{named_property_qu
ery_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator
_callback}}); |
356 {% endif %} | 383 {% endif %} |
357 {% if iterator_method %} | 384 {% if iterator_method %} |
358 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI
teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class}}V8Internal::itera
torMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; | 385 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI
teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Inte
rnal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; |
359 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D
ontDelete, symbolKeyedIteratorConfiguration, isolate); | 386 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D
ontDelete, symbolKeyedIteratorConfiguration, isolate); |
360 {% endif %} | 387 {% endif %} |
361 {# End special operations #} | 388 {# End special operations #} |
362 {% if has_custom_legacy_call_as_function %} | 389 {% if has_custom_legacy_call_as_function %} |
363 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); | 390 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}:
:legacyCallCustom); |
364 {% endif %} | 391 {% endif %} |
365 {% if interface_name == 'HTMLAllCollection' %} | 392 {% if interface_name == 'HTMLAllCollection' %} |
366 {# Needed for legacy support of document.all #} | 393 {# Needed for legacy support of document.all #} |
367 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 394 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
368 {% endif %} | 395 {% endif %} |
(...skipping 12 matching lines...) Expand all Loading... |
381 {% endfilter %}{# conditional() #} | 408 {% endfilter %}{# conditional() #} |
382 {% endfor %} | 409 {% endfor %} |
383 {% for attribute in attributes if attribute.is_static %} | 410 {% for attribute in attributes if attribute.is_static %} |
384 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 411 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
385 (cpp_class, attribute.name) %} | 412 (cpp_class, attribute.name) %} |
386 {% filter conditional(attribute.conditional_string) %} | 413 {% filter conditional(attribute.conditional_string) %} |
387 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute
.name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New
(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces
sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); | 414 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute
.name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New
(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces
sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
388 {% endfilter %} | 415 {% endfilter %} |
389 {% endfor %} | 416 {% endfor %} |
390 {# Special interfaces #} | 417 {# Special interfaces #} |
| 418 {% if not is_partial %} |
391 {% if interface_name == 'Window' %} | 419 {% if interface_name == 'Window' %} |
392 | 420 |
393 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 421 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
394 functionTemplate->SetHiddenPrototype(true); | 422 functionTemplate->SetHiddenPrototype(true); |
395 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 423 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
396 // Set access check callbacks, but turned off initially. | 424 // Set access check callbacks, but turned off initially. |
397 // When a context is detached from a frame, turn on the access check. | 425 // When a context is detached from a frame, turn on the access check. |
398 // Turning on checks also invalidates inline caches of the object. | 426 // Turning on checks also invalidates inline caches of the object. |
399 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom
, V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr
apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); | 427 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom
, V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr
apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); |
400 {% elif interface_name in [ | 428 {% elif interface_name in [ |
401 'HTMLDocument', 'DedicatedWorkerGlobalScope', | 429 'HTMLDocument', 'DedicatedWorkerGlobalScope', |
402 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} | 430 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} |
403 functionTemplate->SetHiddenPrototype(true); | 431 functionTemplate->SetHiddenPrototype(true); |
404 {% endif %} | 432 {% endif %} |
405 | 433 |
406 // Custom toString template | 434 // Custom toString template |
407 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | 435 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); |
| 436 {% endif %} |
408 } | 437 } |
409 | 438 |
410 {% endif %}{# not is_array_buffer_or_view #} | 439 {% endif %}{# not is_array_buffer_or_view #} |
411 {% endblock %} | 440 {% endblock %} |
412 {##############################################################################} | 441 {##############################################################################} |
413 {% block get_dom_template %}{% endblock %} | 442 {% block get_dom_template %}{% endblock %} |
414 {% block has_instance %}{% endblock %} | 443 {% block has_instance %}{% endblock %} |
415 {% block to_impl %}{% endblock %} | 444 {% block to_impl %}{% endblock %} |
416 {% block to_impl_with_type_check %}{% endblock %} | 445 {% block to_impl_with_type_check %}{% endblock %} |
| 446 {% block install_conditional_attributes %}{% endblock %} |
417 {##############################################################################} | 447 {##############################################################################} |
418 {% block install_conditional_attributes %} | 448 {% block install_conditional_methods %} |
419 {% if has_conditional_attributes %} | 449 {% from 'methods.cpp' import install_conditionally_enabled_methods |
420 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object>
instanceObject, v8::Isolate* isolate) | 450 with context %} |
421 { | 451 {% if is_partial or conditionally_enabled_methods %} |
422 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance
Object->GetPrototype()); | 452 {{install_conditionally_enabled_methods()}} |
423 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont
ext()); | |
424 | |
425 {% for attribute in attributes if attribute.per_context_enabled_function or
attribute.exposed_test %} | |
426 {% filter per_context_enabled(attribute.per_context_enabled_function) %} | |
427 {% filter exposed(attribute.exposed_test) %} | |
428 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati
on =\ | |
429 {{attribute_configuration(attribute)}}; | |
430 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib
uteConfiguration, isolate); | |
431 {% endfilter %} | |
432 {% endfilter %} | |
433 {% endfor %} | |
434 } | |
435 | 453 |
436 {% endif %} | 454 {% endif %} |
437 {% endblock %} | 455 {% endblock %} |
438 {##############################################################################} | |
439 {% block install_conditional_methods %} | |
440 {% if conditionally_enabled_methods %} | |
441 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro
totypeObject, v8::Isolate* isolate) | |
442 { | |
443 {# Define per-context enabled operations #} | |
444 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT
emplate(isolate)); | |
445 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont
ext()); | |
446 ASSERT(context); | |
447 | |
448 {% for method in conditionally_enabled_methods %} | |
449 {% filter per_context_enabled(method.per_context_enabled_function) %} | |
450 {% filter exposed(method.exposed_test) %} | |
451 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio
nTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback,
v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFu
nction()); | |
452 {% endfilter %} | |
453 {% endfilter %} | |
454 {% endfor %} | |
455 } | |
456 | |
457 {% endif %} | |
458 {% endblock %} | |
459 {##############################################################################} | 456 {##############################################################################} |
460 {% block to_active_dom_object %}{% endblock %} | 457 {% block to_active_dom_object %}{% endblock %} |
461 {% block to_event_target %}{% endblock %} | 458 {% block to_event_target %}{% endblock %} |
462 {% block get_shadow_object_template %}{% endblock %} | 459 {% block get_shadow_object_template %}{% endblock %} |
463 {% block wrap %}{% endblock %} | 460 {% block wrap %}{% endblock %} |
464 {% block create_wrapper %}{% endblock %} | 461 {% block create_wrapper %}{% endblock %} |
465 {% block deref_object_and_to_v8_no_inline %}{% endblock %} | 462 {% block deref_object_and_to_v8_no_inline %}{% endblock %} |
466 {% for method in methods if method.is_implemented_in_private_script %} | 463 {% for method in methods if method.is_implemented_in_private_script %} |
467 {{method_implemented_in_private_script(method)}} | 464 {{method_implemented_in_private_script(method)}} |
468 {% endfor %} | 465 {% endfor %} |
469 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 466 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
470 {{attribute_getter_implemented_in_private_script(attribute)}} | 467 {{attribute_getter_implemented_in_private_script(attribute)}} |
471 {% if not attribute.is_read_only or attribute.put_forwards %} | 468 {% if not attribute.is_read_only or attribute.put_forwards %} |
472 {{attribute_setter_implemented_in_private_script(attribute)}} | 469 {{attribute_setter_implemented_in_private_script(attribute)}} |
473 {% endif %} | 470 {% endif %} |
474 {% endfor %} | 471 {% endfor %} |
| 472 {% block partial_interface %}{% endblock %} |
475 } // namespace blink | 473 } // namespace blink |
476 {% endfilter %} | 474 {% endfilter %} |
OLD | NEW |