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 "{{actual_v8_class}}.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' % actual_cpp_class %} |
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 | 27 |
27 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v 8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8 _class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_c lass}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, Wra pperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; | 28 {% set wrapper_type_info_type = '' if has_partial_interface else 'const ' %} |
29 {% if not is_partial %} | |
30 {{wrapper_type_info_type}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin: :kEmbedderBlink, {{v8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class} }::derefObject, {{v8_class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEn abledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrap per_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{ {wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; | |
28 | 31 |
29 {% if is_script_wrappable %} | 32 {% if is_script_wrappable %} |
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. | 33 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. |
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 34 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
32 // bindings/core/v8/ScriptWrappable.h. | 35 // bindings/core/v8/ScriptWrappable.h. |
33 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; | 36 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; |
34 | 37 |
35 {% endif %} | 38 {% endif %} |
36 namespace {{cpp_class}}V8Internal { | 39 {% endif %} |
40 namespace {{actual_cpp_class}}V8Internal { | |
41 {% if has_partial_interface %} | |
42 {% for method in methods %} | |
bashi
2014/10/15 05:29:23
nit: you can merge "for" and "if".
tasak
2014/10/15 11:24:19
Done.
| |
43 {% if method.overloads and method.overloads.has_partial_overloads %} | |
44 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba ckInfo<v8::Value>&) = 0; | |
45 {% endif %} | |
46 {% endfor %} | |
47 {% endif %} | |
37 | 48 |
38 {# Constants #} | 49 {# Constants #} |
39 {% from 'constants.cpp' import constant_getter_callback | 50 {% from 'constants.cpp' import constant_getter_callback |
40 with context %} | 51 with context %} |
41 {% for constant in special_getter_constants %} | 52 {% for constant in special_getter_constants %} |
42 {{constant_getter_callback(constant)}} | 53 {{constant_getter_callback(constant)}} |
43 {% endfor %} | 54 {% endfor %} |
44 {# Attributes #} | 55 {# Attributes #} |
45 {% from 'attributes.cpp' import constructor_getter_callback, | 56 {% from 'attributes.cpp' import constructor_getter_callback, |
46 attribute_getter, attribute_getter_callback, | 57 attribute_getter, attribute_getter_callback, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 exceptionState.throwIfNeeded(); | 109 exceptionState.throwIfNeeded(); |
99 return; | 110 return; |
100 } | 111 } |
101 {% endif %} | 112 {% endif %} |
102 if (info.This()->IsObject()) | 113 if (info.This()->IsObject()) |
103 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | 114 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
104 } | 115 } |
105 | 116 |
106 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 117 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
107 { | 118 { |
108 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value, info); | 119 {{actual_cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v 8Value, info); |
109 } | 120 } |
110 | 121 |
111 {% endif %} | 122 {% endif %} |
112 {% endblock %} | 123 {% endblock %} |
113 {##############################################################################} | 124 {##############################################################################} |
114 {% block security_check_functions %}{% endblock %} | 125 {% block security_check_functions %} |
126 {% if has_access_check_callbacks %} | |
127 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) | |
128 { | |
129 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | |
130 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); | |
131 } | |
132 | |
133 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>) | |
134 { | |
135 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | |
136 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); | |
137 } | |
138 | |
139 {% endif %} | |
140 {% endblock %} | |
141 {##############################################################################} | |
115 {# Methods #} | 142 {# Methods #} |
116 {% from 'methods.cpp' import generate_method, overload_resolution_method, | 143 {% from 'methods.cpp' import generate_method, overload_resolution_method, |
117 method_callback, origin_safe_method_getter, generate_constructor, | 144 method_callback, origin_safe_method_getter, generate_constructor, |
118 method_implemented_in_private_script | 145 method_implemented_in_private_script |
119 with context %} | 146 with context %} |
120 {% for method in methods %} | 147 {% for method in methods %} |
121 {% if method.should_be_exposed_to_script %} | 148 {% if method.should_be_exposed_to_script %} |
122 {% for world_suffix in method.world_suffixes %} | 149 {% for world_suffix in method.world_suffixes %} |
123 {% if not method.is_custom %} | 150 {% if not method.is_custom and method.visible %} |
124 {{generate_method(method, world_suffix)}} | 151 {{generate_method(method, world_suffix)}} |
125 {% endif %} | 152 {% endif %} |
126 {% if method.overloads %} | 153 {% if method.overloads and method.overloads.visible %} |
127 {{overload_resolution_method(method.overloads, world_suffix)}} | 154 {{overload_resolution_method(method.overloads, world_suffix)}} |
128 {% endif %} | 155 {% endif %} |
129 {% if not method.overload_index or method.overloads %} | 156 {% if not method.overload_index or method.overloads %} |
157 {# If overloads_callback_visible_in_partial is True, method callback #} | |
158 {# function used by installAttribute is generated in this partial interface. #} | |
159 {# Otherwise, not generated. Because only 1 callback is available for | |
160 {# each method. #} | |
161 {% if ( method.overloads and method.overloads.visible and | |
bashi
2014/10/15 05:29:23
nit: remove space after/before open/close parenthe
tasak
2014/10/15 11:24:19
Done.
| |
162 (not method.overloads.has_partial_overloads or not is_partial) ) or | |
163 (not method.overloads and method.visible) %} | |
130 {# A single callback is generated for overloaded methods #} | 164 {# A single callback is generated for overloaded methods #} |
165 {# with considering partial overloads #} | |
131 {{method_callback(method, world_suffix)}} | 166 {{method_callback(method, world_suffix)}} |
132 {% endif %} | 167 {% endif %} |
133 {% if method.is_do_not_check_security %} | 168 {% endif %} |
169 {% if method.is_do_not_check_security and method.visible %} | |
134 {{origin_safe_method_getter(method, world_suffix)}} | 170 {{origin_safe_method_getter(method, world_suffix)}} |
135 {% endif %} | 171 {% endif %} |
136 {% endfor %} | 172 {% endfor %} |
137 {% endif %} | 173 {% endif %} |
138 {% endfor %} | 174 {% endfor %} |
139 {% if iterator_method %} | 175 {% if iterator_method %} |
140 {{generate_method(iterator_method)}} | 176 {{generate_method(iterator_method)}} |
141 {{method_callback(iterator_method)}} | 177 {{method_callback(iterator_method)}} |
142 {% endif %} | 178 {% endif %} |
143 {% block origin_safe_method_setter %}{% endblock %} | 179 {% block origin_safe_method_setter %}{% endblock %} |
(...skipping 13 matching lines...) Expand all Loading... | |
157 {% block named_property_getter %}{% endblock %} | 193 {% block named_property_getter %}{% endblock %} |
158 {% block named_property_getter_callback %}{% endblock %} | 194 {% block named_property_getter_callback %}{% endblock %} |
159 {% block named_property_setter %}{% endblock %} | 195 {% block named_property_setter %}{% endblock %} |
160 {% block named_property_setter_callback %}{% endblock %} | 196 {% block named_property_setter_callback %}{% endblock %} |
161 {% block named_property_query %}{% endblock %} | 197 {% block named_property_query %}{% endblock %} |
162 {% block named_property_query_callback %}{% endblock %} | 198 {% block named_property_query_callback %}{% endblock %} |
163 {% block named_property_deleter %}{% endblock %} | 199 {% block named_property_deleter %}{% endblock %} |
164 {% block named_property_deleter_callback %}{% endblock %} | 200 {% block named_property_deleter_callback %}{% endblock %} |
165 {% block named_property_enumerator %}{% endblock %} | 201 {% block named_property_enumerator %}{% endblock %} |
166 {% block named_property_enumerator_callback %}{% endblock %} | 202 {% block named_property_enumerator_callback %}{% endblock %} |
167 } // namespace {{cpp_class}}V8Internal | 203 } // namespace {{actual_cpp_class}}V8Internal |
168 | 204 |
169 {% block visit_dom_wrapper %}{% endblock %} | 205 {% block visit_dom_wrapper %}{% endblock %} |
170 {% block shadow_attributes %}{% endblock %} | 206 {% block shadow_attributes %}{% endblock %} |
171 {##############################################################################} | 207 {##############################################################################} |
172 {% block install_attributes %} | 208 {% block install_attributes %} |
209 {% from 'attributes.cpp' import attribute_configuration with context %} | |
173 {% if has_attribute_configuration %} | 210 {% if has_attribute_configuration %} |
174 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { | 211 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { |
175 {% for attribute in attributes | 212 {% for attribute in attributes |
176 if not (attribute.is_expose_js_accessors or | 213 if not (attribute.is_expose_js_accessors or |
177 attribute.is_static or | 214 attribute.is_static or |
178 attribute.runtime_enabled_function or | 215 attribute.runtime_enabled_function or |
179 attribute.per_context_enabled_function or | 216 attribute.per_context_enabled_function or |
180 attribute.exposed_test or | 217 attribute.exposed_test or |
181 (interface_name == 'Window' and attribute.is_unforgeable)) | 218 (interface_name == 'Window' and attribute.is_unforgeable)) |
182 and attribute.should_be_exposed_to_script %} | 219 and attribute.should_be_exposed_to_script %} |
183 {% filter conditional(attribute.conditional_string) %} | 220 {% filter conditional(attribute.conditional_string) %} |
184 {{attribute_configuration(attribute)}}, | 221 {{attribute_configuration(attribute)}}, |
185 {% endfilter %} | 222 {% endfilter %} |
186 {% endfor %} | 223 {% endfor %} |
187 }; | 224 }; |
188 | 225 |
189 {% endif %} | 226 {% endif %} |
190 {% endblock %} | 227 {% endblock %} |
191 {##############################################################################} | 228 {##############################################################################} |
192 {% block install_accessors %} | 229 {% block install_accessors %} |
230 {% from 'attributes.cpp' import attribute_configuration with context %} | |
193 {% if has_accessors %} | 231 {% if has_accessors %} |
194 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { | 232 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { |
195 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %} | 233 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %} |
196 {{attribute_configuration(attribute)}}, | 234 {{attribute_configuration(attribute)}}, |
197 {% endfor %} | 235 {% endfor %} |
198 }; | 236 }; |
199 | 237 |
200 {% endif %} | 238 {% endif %} |
201 {% endblock %} | 239 {% endblock %} |
202 {##############################################################################} | 240 {##############################################################################} |
(...skipping 11 matching lines...) Expand all Loading... | |
214 {% endif %} | 252 {% endif %} |
215 {% endblock %} | 253 {% endblock %} |
216 {##############################################################################} | 254 {##############################################################################} |
217 {% block named_constructor %}{% endblock %} | 255 {% block named_constructor %}{% endblock %} |
218 {% block initialize_event %}{% endblock %} | 256 {% block initialize_event %}{% endblock %} |
219 {% block constructor_callback %}{% endblock %} | 257 {% block constructor_callback %}{% endblock %} |
220 {% block configure_shadow_object_template %}{% endblock %} | 258 {% block configure_shadow_object_template %}{% endblock %} |
221 {##############################################################################} | 259 {##############################################################################} |
222 {% block install_dom_template %} | 260 {% block install_dom_template %} |
223 {% from 'methods.cpp' import install_custom_signature with context %} | 261 {% from 'methods.cpp' import install_custom_signature with context %} |
262 {% from 'attributes.cpp' import attribute_configuration with context %} | |
224 {% from 'constants.cpp' import install_constants with context %} | 263 {% from 'constants.cpp' import install_constants with context %} |
264 {% if has_partial_interface or is_partial %} | |
265 void {{actual_v8_class}}::install{{v8_class}}Template(v8::Handle<v8::FunctionTem plate> functionTemplate, v8::Isolate* isolate) | |
266 {% else %} | |
225 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) | 267 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) |
268 {% endif %} | |
226 { | 269 { |
270 {% if is_partial %} | |
271 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate); | |
272 {% else %} | |
227 functionTemplate->ReadOnlyPrototype(); | 273 functionTemplate->ReadOnlyPrototype(); |
274 {% endif %} | |
228 | 275 |
229 v8::Local<v8::Signature> defaultSignature; | 276 v8::Local<v8::Signature> defaultSignature; |
230 {% set parent_template = | 277 {% set parent_template = |
231 'V8%s::domTemplate(isolate)' % parent_interface | 278 'V8%s::domTemplate(isolate)' % parent_interface |
232 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} | 279 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} |
233 {% if runtime_enabled_function %} | 280 {% if runtime_enabled_function %} |
234 if (!{{runtime_enabled_function}}()) | 281 if (!{{runtime_enabled_function}}()) |
235 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); | 282 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); |
236 else | 283 else |
237 {% endif %} | 284 {% endif %} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | 330 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ |
284 {{attribute_configuration(attribute)}}; | 331 {{attribute_configuration(attribute)}}; |
285 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); | 332 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); |
286 } | 333 } |
287 {% endfilter %} | 334 {% endfilter %} |
288 {% endfor %} | 335 {% endfor %} |
289 {% if constants %} | 336 {% if constants %} |
290 {{install_constants() | indent}} | 337 {{install_constants() | indent}} |
291 {% endif %} | 338 {% endif %} |
292 {# Special operations #} | 339 {# Special operations #} |
293 {# V8 has access-check callback API and it's used on Window instead of | 340 {# V8 has access-check callback API and it\'s used on Window instead of |
294 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. | 341 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. |
295 In addition, the getter should be set on the prototype template, to get | 342 In addition, the getter should be set on the prototype template, to get |
296 the implementation straight out of the Window prototype, regardless of | 343 the implementation straight out of the Window prototype, regardless of |
297 what prototype is actually set on the object. #} | 344 what prototype is actually set on the object. #} |
298 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' | 345 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' |
299 else 'InstanceTemplate' %} | 346 else 'InstanceTemplate' %} |
300 {% if indexed_property_getter %} | 347 {% if indexed_property_getter %} |
301 {# if have indexed properties, MUST have an indexed property getter #} | 348 {# if have indexed properties, MUST have an indexed property getter #} |
302 {% set indexed_property_getter_callback = | 349 {% set indexed_property_getter_callback = |
303 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} | 350 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} |
(...skipping 21 matching lines...) Expand all Loading... | |
325 if named_property_getter.is_enumerable else '0' %} | 372 if named_property_getter.is_enumerable else '0' %} |
326 {% set named_property_deleter_callback = | 373 {% set named_property_deleter_callback = |
327 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class | 374 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class |
328 if named_property_deleter else '0' %} | 375 if named_property_deleter else '0' %} |
329 {% set named_property_enumerator_callback = | 376 {% set named_property_enumerator_callback = |
330 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class | 377 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class |
331 if named_property_getter.is_enumerable else '0' %} | 378 if named_property_getter.is_enumerable else '0' %} |
332 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}}); | 379 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}}); |
333 {% endif %} | 380 {% endif %} |
334 {% if iterator_method %} | 381 {% if iterator_method %} |
335 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class}}V8Internal::itera torMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; | 382 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{actual_cpp_class}}V8Internal ::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; |
336 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); | 383 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); |
337 {% endif %} | 384 {% endif %} |
338 {# End special operations #} | 385 {# End special operations #} |
339 {% if has_custom_legacy_call_as_function %} | 386 {% if has_custom_legacy_call_as_function %} |
340 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); | 387 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); |
341 {% endif %} | 388 {% endif %} |
342 {% if interface_name == 'HTMLAllCollection' %} | 389 {% if interface_name == 'HTMLAllCollection' %} |
343 {# Needed for legacy support of document.all #} | 390 {# Needed for legacy support of document.all #} |
344 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 391 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
345 {% endif %} | 392 {% endif %} |
(...skipping 12 matching lines...) Expand all Loading... | |
358 {% endfilter %}{# conditional() #} | 405 {% endfilter %}{# conditional() #} |
359 {% endfor %} | 406 {% endfor %} |
360 {% for attribute in attributes if attribute.is_static %} | 407 {% for attribute in attributes if attribute.is_static %} |
361 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 408 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
362 (cpp_class, attribute.name) %} | 409 (cpp_class, attribute.name) %} |
363 {% filter conditional(attribute.conditional_string) %} | 410 {% filter conditional(attribute.conditional_string) %} |
364 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)); | 411 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)); |
365 {% endfilter %} | 412 {% endfilter %} |
366 {% endfor %} | 413 {% endfor %} |
367 {# Special interfaces #} | 414 {# Special interfaces #} |
415 {% if not is_partial %} | |
368 {% if interface_name == 'Window' %} | 416 {% if interface_name == 'Window' %} |
369 | 417 |
370 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 418 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
371 functionTemplate->SetHiddenPrototype(true); | 419 functionTemplate->SetHiddenPrototype(true); |
372 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 420 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
373 // Set access check callbacks, but turned off initially. | 421 // Set access check callbacks, but turned off initially. |
374 // When a context is detached from a frame, turn on the access check. | 422 // When a context is detached from a frame, turn on the access check. |
375 // Turning on checks also invalidates inline caches of the object. | 423 // Turning on checks also invalidates inline caches of the object. |
376 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); | 424 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); |
377 {% elif interface_name in [ | 425 {% elif interface_name in [ |
378 'HTMLDocument', 'DedicatedWorkerGlobalScope', | 426 'HTMLDocument', 'DedicatedWorkerGlobalScope', |
379 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} | 427 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} |
380 functionTemplate->SetHiddenPrototype(true); | 428 functionTemplate->SetHiddenPrototype(true); |
381 {% endif %} | 429 {% endif %} |
382 | 430 |
383 // Custom toString template | 431 // Custom toString template |
384 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); | 432 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); |
433 {% endif %} | |
385 } | 434 } |
386 | 435 |
387 {% endblock %} | 436 {% endblock %} |
388 {##############################################################################} | 437 {##############################################################################} |
389 {% block get_dom_template %}{% endblock %} | 438 {% block get_dom_template %}{% endblock %} |
390 {% block has_instance %}{% endblock %} | 439 {% block has_instance %}{% endblock %} |
391 {% block to_impl_with_type_check %}{% endblock %} | 440 {% block to_impl_with_type_check %}{% endblock %} |
392 {% block install_conditional_attributes %}{% endblock %} | 441 {##############################################################################} |
393 {% block install_conditional_methods %}{% endblock %} | 442 {% block install_conditional_attributes %} |
443 {% from 'attributes.cpp' import install_conditionally_enabled_properties | |
444 with context %} | |
445 {% if is_partial or has_conditional_attributes %} | |
446 {{install_conditionally_enabled_properties()}} | |
447 | |
448 {% endif %} | |
449 {% endblock %} | |
450 {##############################################################################} | |
451 {% block install_conditional_methods %} | |
452 {% from 'methods.cpp' import install_conditionally_enabled_methods | |
453 with context %} | |
454 {% if is_partial or conditionally_enabled_methods %} | |
455 {{install_conditionally_enabled_methods()}} | |
456 | |
457 {% endif %} | |
458 {% endblock %} | |
459 {##############################################################################} | |
394 {% block to_active_dom_object %}{% endblock %} | 460 {% block to_active_dom_object %}{% endblock %} |
395 {% block to_event_target %}{% endblock %} | 461 {% block to_event_target %}{% endblock %} |
396 {% block get_shadow_object_template %}{% endblock %} | 462 {% block get_shadow_object_template %}{% endblock %} |
397 {% block wrap %}{% endblock %} | 463 {% block wrap %}{% endblock %} |
398 {% block create_wrapper %}{% endblock %} | 464 {% block create_wrapper %}{% endblock %} |
399 {% block deref_object_and_to_v8_no_inline %}{% endblock %} | 465 {% block deref_object_and_to_v8_no_inline %}{% endblock %} |
400 {% for method in methods if method.is_implemented_in_private_script %} | 466 {% for method in methods if method.is_implemented_in_private_script %} |
401 {{method_implemented_in_private_script(method)}} | 467 {{method_implemented_in_private_script(method)}} |
402 {% endfor %} | 468 {% endfor %} |
403 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 469 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
404 {{attribute_getter_implemented_in_private_script(attribute)}} | 470 {{attribute_getter_implemented_in_private_script(attribute)}} |
405 {% if not attribute.is_read_only or attribute.put_forwards %} | 471 {% if not attribute.is_read_only or attribute.put_forwards %} |
406 {{attribute_setter_implemented_in_private_script(attribute)}} | 472 {{attribute_setter_implemented_in_private_script(attribute)}} |
407 {% endif %} | 473 {% endif %} |
408 {% endfor %} | 474 {% endfor %} |
475 {% block partial_interface %}{% endblock %} | |
409 } // namespace blink | 476 } // namespace blink |
410 {% endfilter %} | 477 {% endfilter %} |
OLD | NEW |