Chromium Code Reviews| 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 ' %} |
|
haraken
2014/10/16 04:24:08
wrapper_type_info_type => wrapper_type_info_const
tasak
2014/10/17 07:38:18
Done.
| |
| 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 if method.overloads and method.overloads.has_partial_ov erloads %} | |
| 43 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba ckInfo<v8::Value>&) = 0; | |
| 44 {% endfor %} | |
| 45 {% endif %} | |
| 37 | 46 |
| 38 {# Constants #} | 47 {# Constants #} |
| 39 {% from 'constants.cpp' import constant_getter_callback | 48 {% from 'constants.cpp' import constant_getter_callback |
| 40 with context %} | 49 with context %} |
| 41 {% for constant in special_getter_constants %} | 50 {% for constant in special_getter_constants %} |
| 42 {{constant_getter_callback(constant)}} | 51 {{constant_getter_callback(constant)}} |
| 43 {% endfor %} | 52 {% endfor %} |
| 44 {# Attributes #} | 53 {# Attributes #} |
| 45 {% from 'attributes.cpp' import constructor_getter_callback, | 54 {% from 'attributes.cpp' import constructor_getter_callback, |
| 46 attribute_getter, attribute_getter_callback, | 55 attribute_getter, attribute_getter_callback, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 exceptionState.throwIfNeeded(); | 107 exceptionState.throwIfNeeded(); |
| 99 return; | 108 return; |
| 100 } | 109 } |
| 101 {% endif %} | 110 {% endif %} |
| 102 if (info.This()->IsObject()) | 111 if (info.This()->IsObject()) |
| 103 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | 112 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
| 104 } | 113 } |
| 105 | 114 |
| 106 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 115 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| 107 { | 116 { |
| 108 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value, info); | 117 {{actual_cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v 8Value, info); |
| 109 } | 118 } |
| 110 | 119 |
| 111 {% endif %} | 120 {% endif %} |
| 112 {% endblock %} | 121 {% endblock %} |
| 113 {##############################################################################} | 122 {##############################################################################} |
| 114 {% block security_check_functions %} | 123 {% block security_check_functions %} |
| 115 {% if has_access_check_callbacks %} | 124 {% if has_access_check_callbacks %} |
| 116 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) | 125 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) |
| 117 { | 126 { |
| 118 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); | 127 {{cpp_class}}* impl = {{v8_class}}::toImpl(host); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 129 {% endblock %} | 138 {% endblock %} |
| 130 {##############################################################################} | 139 {##############################################################################} |
| 131 {# Methods #} | 140 {# Methods #} |
| 132 {% from 'methods.cpp' import generate_method, overload_resolution_method, | 141 {% from 'methods.cpp' import generate_method, overload_resolution_method, |
| 133 method_callback, origin_safe_method_getter, generate_constructor, | 142 method_callback, origin_safe_method_getter, generate_constructor, |
| 134 method_implemented_in_private_script | 143 method_implemented_in_private_script |
| 135 with context %} | 144 with context %} |
| 136 {% for method in methods %} | 145 {% for method in methods %} |
| 137 {% if method.should_be_exposed_to_script %} | 146 {% if method.should_be_exposed_to_script %} |
| 138 {% for world_suffix in method.world_suffixes %} | 147 {% for world_suffix in method.world_suffixes %} |
| 139 {% if not method.is_custom %} | 148 {% if not method.is_custom and method.visible %} |
| 140 {{generate_method(method, world_suffix)}} | 149 {{generate_method(method, world_suffix)}} |
| 141 {% endif %} | 150 {% endif %} |
| 142 {% if method.overloads %} | 151 {% if method.overloads and method.overloads.visible %} |
| 143 {{overload_resolution_method(method.overloads, world_suffix)}} | 152 {{overload_resolution_method(method.overloads, world_suffix)}} |
| 144 {% endif %} | 153 {% endif %} |
| 145 {% if not method.overload_index or method.overloads %} | 154 {% if not method.overload_index or method.overloads %} |
| 155 {# If overloads_callback_visible_in_partial is True, method callback #} | |
|
haraken
2014/10/16 04:24:08
What is overloads_callback_visible_in_partial?
tasak
2014/10/17 07:38:18
Removed.
| |
| 156 {# function used by installAttribute is generated in this partial interface. #} | |
| 157 {# Otherwise, not generated. Because only 1 callback is available for | |
| 158 {# each method. #} | |
| 159 {% if (method.overloads and method.overloads.visible and | |
| 160 (not method.overloads.has_partial_overloads or not is_partial)) or | |
| 161 (not method.overloads and method.visible) %} | |
|
haraken
2014/10/16 04:24:08
Discussed offline and I finally understood what th
tasak
2014/10/17 07:38:18
https://docs.google.com/document/d/1qBC7Therp437Jb
| |
| 146 {# A single callback is generated for overloaded methods #} | 162 {# A single callback is generated for overloaded methods #} |
| 163 {# with considering partial overloads #} | |
| 147 {{method_callback(method, world_suffix)}} | 164 {{method_callback(method, world_suffix)}} |
| 148 {% endif %} | 165 {% endif %} |
| 149 {% if method.is_do_not_check_security %} | 166 {% endif %} |
| 167 {% if method.is_do_not_check_security and method.visible %} | |
| 150 {{origin_safe_method_getter(method, world_suffix)}} | 168 {{origin_safe_method_getter(method, world_suffix)}} |
| 151 {% endif %} | 169 {% endif %} |
| 152 {% endfor %} | 170 {% endfor %} |
| 153 {% endif %} | 171 {% endif %} |
| 154 {% endfor %} | 172 {% endfor %} |
| 155 {% if iterator_method %} | 173 {% if iterator_method %} |
| 156 {{generate_method(iterator_method)}} | 174 {{generate_method(iterator_method)}} |
| 157 {{method_callback(iterator_method)}} | 175 {{method_callback(iterator_method)}} |
| 158 {% endif %} | 176 {% endif %} |
| 159 {% block origin_safe_method_setter %}{% endblock %} | 177 {% block origin_safe_method_setter %}{% endblock %} |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 173 {% block named_property_getter %}{% endblock %} | 191 {% block named_property_getter %}{% endblock %} |
| 174 {% block named_property_getter_callback %}{% endblock %} | 192 {% block named_property_getter_callback %}{% endblock %} |
| 175 {% block named_property_setter %}{% endblock %} | 193 {% block named_property_setter %}{% endblock %} |
| 176 {% block named_property_setter_callback %}{% endblock %} | 194 {% block named_property_setter_callback %}{% endblock %} |
| 177 {% block named_property_query %}{% endblock %} | 195 {% block named_property_query %}{% endblock %} |
| 178 {% block named_property_query_callback %}{% endblock %} | 196 {% block named_property_query_callback %}{% endblock %} |
| 179 {% block named_property_deleter %}{% endblock %} | 197 {% block named_property_deleter %}{% endblock %} |
| 180 {% block named_property_deleter_callback %}{% endblock %} | 198 {% block named_property_deleter_callback %}{% endblock %} |
| 181 {% block named_property_enumerator %}{% endblock %} | 199 {% block named_property_enumerator %}{% endblock %} |
| 182 {% block named_property_enumerator_callback %}{% endblock %} | 200 {% block named_property_enumerator_callback %}{% endblock %} |
| 183 } // namespace {{cpp_class}}V8Internal | 201 } // namespace {{actual_cpp_class}}V8Internal |
| 184 | 202 |
| 185 {% block visit_dom_wrapper %}{% endblock %} | 203 {% block visit_dom_wrapper %}{% endblock %} |
| 186 {% block shadow_attributes %}{% endblock %} | 204 {% block shadow_attributes %}{% endblock %} |
| 187 {##############################################################################} | 205 {##############################################################################} |
| 188 {% block install_attributes %} | 206 {% block install_attributes %} |
| 207 {% from 'attributes.cpp' import attribute_configuration with context %} | |
| 189 {% if has_attribute_configuration %} | 208 {% if has_attribute_configuration %} |
| 190 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { | 209 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { |
| 191 {% for attribute in attributes | 210 {% for attribute in attributes |
| 192 if not (attribute.is_expose_js_accessors or | 211 if not (attribute.is_expose_js_accessors or |
| 193 attribute.is_static or | 212 attribute.is_static or |
| 194 attribute.runtime_enabled_function or | 213 attribute.runtime_enabled_function or |
| 195 attribute.per_context_enabled_function or | 214 attribute.per_context_enabled_function or |
| 196 attribute.exposed_test or | 215 attribute.exposed_test or |
| 197 (interface_name == 'Window' and attribute.is_unforgeable)) | 216 (interface_name == 'Window' and attribute.is_unforgeable)) |
| 198 and attribute.should_be_exposed_to_script %} | 217 and attribute.should_be_exposed_to_script %} |
| 199 {% filter conditional(attribute.conditional_string) %} | 218 {% filter conditional(attribute.conditional_string) %} |
| 200 {{attribute_configuration(attribute)}}, | 219 {{attribute_configuration(attribute)}}, |
| 201 {% endfilter %} | 220 {% endfilter %} |
| 202 {% endfor %} | 221 {% endfor %} |
| 203 }; | 222 }; |
| 204 | 223 |
| 205 {% endif %} | 224 {% endif %} |
| 206 {% endblock %} | 225 {% endblock %} |
| 207 {##############################################################################} | 226 {##############################################################################} |
| 208 {% block install_accessors %} | 227 {% block install_accessors %} |
| 228 {% from 'attributes.cpp' import attribute_configuration with context %} | |
| 209 {% if has_accessors %} | 229 {% if has_accessors %} |
| 210 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { | 230 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { |
| 211 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %} | 231 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %} |
| 212 {{attribute_configuration(attribute)}}, | 232 {{attribute_configuration(attribute)}}, |
| 213 {% endfor %} | 233 {% endfor %} |
| 214 }; | 234 }; |
| 215 | 235 |
| 216 {% endif %} | 236 {% endif %} |
| 217 {% endblock %} | 237 {% endblock %} |
| 218 {##############################################################################} | 238 {##############################################################################} |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 230 {% endif %} | 250 {% endif %} |
| 231 {% endblock %} | 251 {% endblock %} |
| 232 {##############################################################################} | 252 {##############################################################################} |
| 233 {% block named_constructor %}{% endblock %} | 253 {% block named_constructor %}{% endblock %} |
| 234 {% block initialize_event %}{% endblock %} | 254 {% block initialize_event %}{% endblock %} |
| 235 {% block constructor_callback %}{% endblock %} | 255 {% block constructor_callback %}{% endblock %} |
| 236 {% block configure_shadow_object_template %}{% endblock %} | 256 {% block configure_shadow_object_template %}{% endblock %} |
| 237 {##############################################################################} | 257 {##############################################################################} |
| 238 {% block install_dom_template %} | 258 {% block install_dom_template %} |
| 239 {% from 'methods.cpp' import install_custom_signature with context %} | 259 {% from 'methods.cpp' import install_custom_signature with context %} |
| 260 {% from 'attributes.cpp' import attribute_configuration with context %} | |
| 240 {% from 'constants.cpp' import install_constants with context %} | 261 {% from 'constants.cpp' import install_constants with context %} |
| 262 {% if has_partial_interface or is_partial %} | |
| 263 void {{actual_v8_class}}::install{{v8_class}}Template(v8::Handle<v8::FunctionTem plate> functionTemplate, v8::Isolate* isolate) | |
| 264 {% else %} | |
| 241 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) | 265 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) |
| 266 {% endif %} | |
| 242 { | 267 { |
| 268 {% if is_partial %} | |
| 269 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate); | |
| 270 {% else %} | |
| 243 functionTemplate->ReadOnlyPrototype(); | 271 functionTemplate->ReadOnlyPrototype(); |
| 272 {% endif %} | |
| 244 | 273 |
| 245 v8::Local<v8::Signature> defaultSignature; | 274 v8::Local<v8::Signature> defaultSignature; |
| 246 {% set parent_template = | 275 {% set parent_template = |
| 247 'V8%s::domTemplate(isolate)' % parent_interface | 276 'V8%s::domTemplate(isolate)' % parent_interface |
| 248 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} | 277 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} |
| 249 {% if runtime_enabled_function %} | 278 {% if runtime_enabled_function %} |
| 250 if (!{{runtime_enabled_function}}()) | 279 if (!{{runtime_enabled_function}}()) |
| 251 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); | 280 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); |
| 252 else | 281 else |
| 253 {% endif %} | 282 {% endif %} |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | 328 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ |
| 300 {{attribute_configuration(attribute)}}; | 329 {{attribute_configuration(attribute)}}; |
| 301 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); | 330 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); |
| 302 } | 331 } |
| 303 {% endfilter %} | 332 {% endfilter %} |
| 304 {% endfor %} | 333 {% endfor %} |
| 305 {% if constants %} | 334 {% if constants %} |
| 306 {{install_constants() | indent}} | 335 {{install_constants() | indent}} |
| 307 {% endif %} | 336 {% endif %} |
| 308 {# Special operations #} | 337 {# Special operations #} |
| 309 {# V8 has access-check callback API and it's used on Window instead of | 338 {# V8 has access-check callback API and it\'s used on Window instead of |
| 310 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. | 339 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. |
| 311 In addition, the getter should be set on the prototype template, to get | 340 In addition, the getter should be set on the prototype template, to get |
| 312 the implementation straight out of the Window prototype, regardless of | 341 the implementation straight out of the Window prototype, regardless of |
| 313 what prototype is actually set on the object. #} | 342 what prototype is actually set on the object. #} |
| 314 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' | 343 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' |
| 315 else 'InstanceTemplate' %} | 344 else 'InstanceTemplate' %} |
| 316 {% if indexed_property_getter %} | 345 {% if indexed_property_getter %} |
| 317 {# if have indexed properties, MUST have an indexed property getter #} | 346 {# if have indexed properties, MUST have an indexed property getter #} |
| 318 {% set indexed_property_getter_callback = | 347 {% set indexed_property_getter_callback = |
| 319 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} | 348 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 341 if named_property_getter.is_enumerable else '0' %} | 370 if named_property_getter.is_enumerable else '0' %} |
| 342 {% set named_property_deleter_callback = | 371 {% set named_property_deleter_callback = |
| 343 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class | 372 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class |
| 344 if named_property_deleter else '0' %} | 373 if named_property_deleter else '0' %} |
| 345 {% set named_property_enumerator_callback = | 374 {% set named_property_enumerator_callback = |
| 346 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class | 375 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class |
| 347 if named_property_getter.is_enumerable else '0' %} | 376 if named_property_getter.is_enumerable else '0' %} |
| 348 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}}); | 377 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}}); |
| 349 {% endif %} | 378 {% endif %} |
| 350 {% if iterator_method %} | 379 {% if iterator_method %} |
| 351 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class}}V8Internal::itera torMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; | 380 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{actual_cpp_class}}V8Internal ::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; |
| 352 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); | 381 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); |
| 353 {% endif %} | 382 {% endif %} |
| 354 {# End special operations #} | 383 {# End special operations #} |
| 355 {% if has_custom_legacy_call_as_function %} | 384 {% if has_custom_legacy_call_as_function %} |
| 356 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); | 385 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); |
| 357 {% endif %} | 386 {% endif %} |
| 358 {% if interface_name == 'HTMLAllCollection' %} | 387 {% if interface_name == 'HTMLAllCollection' %} |
| 359 {# Needed for legacy support of document.all #} | 388 {# Needed for legacy support of document.all #} |
| 360 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 389 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
| 361 {% endif %} | 390 {% endif %} |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 374 {% endfilter %}{# conditional() #} | 403 {% endfilter %}{# conditional() #} |
| 375 {% endfor %} | 404 {% endfor %} |
| 376 {% for attribute in attributes if attribute.is_static %} | 405 {% for attribute in attributes if attribute.is_static %} |
| 377 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 406 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
| 378 (cpp_class, attribute.name) %} | 407 (cpp_class, attribute.name) %} |
| 379 {% filter conditional(attribute.conditional_string) %} | 408 {% filter conditional(attribute.conditional_string) %} |
| 380 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)); | 409 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)); |
| 381 {% endfilter %} | 410 {% endfilter %} |
| 382 {% endfor %} | 411 {% endfor %} |
| 383 {# Special interfaces #} | 412 {# Special interfaces #} |
| 413 {% if not is_partial %} | |
|
haraken
2014/10/16 04:24:08
Do we need this check?
tasak
2014/10/17 07:38:18
Yes, because interface_name is 'Window' when gener
| |
| 384 {% if interface_name == 'Window' %} | 414 {% if interface_name == 'Window' %} |
| 385 | 415 |
| 386 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 416 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 387 functionTemplate->SetHiddenPrototype(true); | 417 functionTemplate->SetHiddenPrototype(true); |
| 388 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 418 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 389 // Set access check callbacks, but turned off initially. | 419 // Set access check callbacks, but turned off initially. |
| 390 // When a context is detached from a frame, turn on the access check. | 420 // When a context is detached from a frame, turn on the access check. |
| 391 // Turning on checks also invalidates inline caches of the object. | 421 // Turning on checks also invalidates inline caches of the object. |
| 392 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); | 422 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); |
| 393 {% elif interface_name in [ | 423 {% elif interface_name in [ |
| 394 'HTMLDocument', 'DedicatedWorkerGlobalScope', | 424 'HTMLDocument', 'DedicatedWorkerGlobalScope', |
| 395 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} | 425 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} |
| 396 functionTemplate->SetHiddenPrototype(true); | 426 functionTemplate->SetHiddenPrototype(true); |
| 397 {% endif %} | 427 {% endif %} |
| 398 | 428 |
| 399 // Custom toString template | 429 // Custom toString template |
| 400 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); | 430 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); |
| 431 {% endif %} | |
| 401 } | 432 } |
| 402 | 433 |
| 403 {% endblock %} | 434 {% endblock %} |
| 404 {##############################################################################} | 435 {##############################################################################} |
| 405 {% block get_dom_template %}{% endblock %} | 436 {% block get_dom_template %}{% endblock %} |
| 406 {% block has_instance %}{% endblock %} | 437 {% block has_instance %}{% endblock %} |
| 407 {% block to_impl_with_type_check %}{% endblock %} | 438 {% block to_impl_with_type_check %}{% endblock %} |
| 408 {##############################################################################} | 439 {##############################################################################} |
| 409 {% block install_conditional_attributes %} | 440 {% block install_conditional_attributes %} |
| 410 {% if has_conditional_attributes %} | 441 {% from 'attributes.cpp' import install_conditionally_enabled_properties |
| 411 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) | 442 with context %} |
| 412 { | 443 {% if is_partial or has_conditional_attributes %} |
|
haraken
2014/10/16 04:24:08
Not related to your CL, |has_conditional_attribute
tasak
2014/10/17 07:38:18
I will do in another CL.
| |
| 413 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); | 444 {{install_conditionally_enabled_properties()}} |
| 414 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); | |
| 415 | |
| 416 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} | |
| 417 {% filter per_context_enabled(attribute.per_context_enabled_function) %} | |
| 418 {% filter exposed(attribute.exposed_test) %} | |
| 419 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\ | |
| 420 {{attribute_configuration(attribute)}}; | |
| 421 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib uteConfiguration, isolate); | |
| 422 {% endfilter %} | |
| 423 {% endfilter %} | |
| 424 {% endfor %} | |
| 425 } | |
| 426 | 445 |
| 427 {% endif %} | 446 {% endif %} |
| 428 {% endblock %} | 447 {% endblock %} |
| 429 {##############################################################################} | 448 {##############################################################################} |
| 430 {% block install_conditional_methods %} | 449 {% block install_conditional_methods %} |
| 431 {% if conditionally_enabled_methods %} | 450 {% from 'methods.cpp' import install_conditionally_enabled_methods |
| 432 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro totypeObject, v8::Isolate* isolate) | 451 with context %} |
| 433 { | 452 {% if is_partial or conditionally_enabled_methods %} |
| 434 {# Define per-context enabled operations #} | 453 {{install_conditionally_enabled_methods()}} |
| 435 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate)); | |
| 436 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); | |
| 437 ASSERT(context); | |
| 438 | |
| 439 {% for method in conditionally_enabled_methods %} | |
| 440 {% filter per_context_enabled(method.per_context_enabled_function) %} | |
| 441 {% filter exposed(method.exposed_test) %} | |
| 442 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()); | |
| 443 {% endfilter %} | |
| 444 {% endfilter %} | |
| 445 {% endfor %} | |
| 446 } | |
| 447 | 454 |
| 448 {% endif %} | 455 {% endif %} |
| 449 {% endblock %} | 456 {% endblock %} |
| 450 {##############################################################################} | 457 {##############################################################################} |
| 451 {% block to_active_dom_object %}{% endblock %} | 458 {% block to_active_dom_object %}{% endblock %} |
| 452 {% block to_event_target %}{% endblock %} | 459 {% block to_event_target %}{% endblock %} |
| 453 {% block get_shadow_object_template %}{% endblock %} | 460 {% block get_shadow_object_template %}{% endblock %} |
| 454 {% block wrap %}{% endblock %} | 461 {% block wrap %}{% endblock %} |
| 455 {% block create_wrapper %}{% endblock %} | 462 {% block create_wrapper %}{% endblock %} |
| 456 {% block deref_object_and_to_v8_no_inline %}{% endblock %} | 463 {% block deref_object_and_to_v8_no_inline %}{% endblock %} |
| 457 {% for method in methods if method.is_implemented_in_private_script %} | 464 {% for method in methods if method.is_implemented_in_private_script %} |
| 458 {{method_implemented_in_private_script(method)}} | 465 {{method_implemented_in_private_script(method)}} |
| 459 {% endfor %} | 466 {% endfor %} |
| 460 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 467 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 461 {{attribute_getter_implemented_in_private_script(attribute)}} | 468 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 462 {% if not attribute.is_read_only or attribute.put_forwards %} | 469 {% if not attribute.is_read_only or attribute.put_forwards %} |
| 463 {{attribute_setter_implemented_in_private_script(attribute)}} | 470 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 464 {% endif %} | 471 {% endif %} |
| 465 {% endfor %} | 472 {% endfor %} |
| 473 {% block partial_interface %}{% endblock %} | |
| 466 } // namespace blink | 474 } // namespace blink |
| 467 {% endfilter %} | 475 {% endfilter %} |
| OLD | NEW |