Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro attribute_configuration(attribute) %} | 5 {% macro attribute_configuration(attribute) %} |
| 6 {% set getter_callback = | 6 {% set getter_callback = |
| 7 '%sV8Internal::%sAttributeGetterCallback' % | 7 '%sV8Internal::%sAttributeGetterCallback' % |
| 8 (interface_name, attribute.name) | 8 (interface_name, attribute.name) |
| 9 if not attribute.constructor_type else | 9 if not attribute.constructor_type else |
| 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} | 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 {% endblock %} | 235 {% endblock %} |
| 236 | 236 |
| 237 | 237 |
| 238 {##############################################################################} | 238 {##############################################################################} |
| 239 {% block configure_class_template %} | 239 {% block configure_class_template %} |
| 240 {# FIXME: rename to install_dom_template and Install{{v8_class}}DOMTemplate #} | 240 {# FIXME: rename to install_dom_template and Install{{v8_class}}DOMTemplate #} |
| 241 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class}}Template(v8::Handle <v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 241 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class}}Template(v8::Handle <v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 242 { | 242 { |
| 243 functionTemplate->ReadOnlyPrototype(); | 243 functionTemplate->ReadOnlyPrototype(); |
| 244 | 244 |
| 245 v8::Local<v8::Signature> defaultSignature; | 245 v8::Local<v8::Signature> ALLOW_UNUSED defaultSignature; |
| 246 {% if runtime_enabled_function %} | 246 {% if runtime_enabled_function %} |
| 247 if (!{{runtime_enabled_function}}()) | 247 if (!{{runtime_enabled_function}}()) |
| 248 {# FIXME: support inheritance #} | 248 {# FIXME: support inheritance #} |
| 249 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", v8::Local<v8::FunctionTemplate>(), {{v8_class}}::internalFieldCount , 0, 0, 0, 0, 0, 0, isolate, currentWorldType); | 249 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", v8::Local<v8::FunctionTemplate>(), {{v8_class}}::internalFieldCount , 0, 0, 0, 0, 0, 0, isolate, currentWorldType); |
| 250 else | 250 else |
| 251 {% endif %} | 251 {% endif %} |
| 252 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} | 252 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} |
| 253 {% filter indent(runtime_enabled_indent, true) %} | 253 {% filter indent(runtime_enabled_indent, true) %} |
| 254 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "{{interface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class}}::inte rnalFieldCount, | 254 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "{{interface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class}}::inte rnalFieldCount, |
| 255 {# Test needed as size 0 constant arrays are not allowed in VC++ #} | 255 {# Test needed as size 0 constant arrays are not allowed in VC++ #} |
| 256 {% set attributes_name, attributes_length = | 256 {% set attributes_name, attributes_length = |
| 257 ('%sAttributes' % v8_class, | 257 ('%sAttributes' % v8_class, |
| 258 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) | 258 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) |
| 259 if attributes else (0, 0) %} | 259 if attributes else (0, 0) %} |
| 260 {% set accessors_name, accessors_length = | 260 {% set accessors_name, accessors_length = |
| 261 ('%sAccessors' % v8_class, | 261 ('%sAccessors' % v8_class, |
| 262 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) | 262 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) |
| 263 if has_accessors else (0, 0) %} | 263 if has_accessors else (0, 0) %} |
| 264 {% set methods_name, methods_length = | 264 {% set methods_name, methods_length = |
| 265 ('%sMethods' % v8_class, | 265 ('%sMethods' % v8_class, |
| 266 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) | 266 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) |
| 267 if has_method_configuration else (0, 0) %} | 267 if has_method_configuration else (0, 0) %} |
| 268 {{attributes_name}}, {{attributes_length}}, | 268 {{attributes_name}}, {{attributes_length}}, |
| 269 {{accessors_name}}, {{accessors_length}}, | 269 {{accessors_name}}, {{accessors_length}}, |
| 270 {{methods_name}}, {{methods_length}}, | 270 {{methods_name}}, {{methods_length}}, |
| 271 isolate, currentWorldType); | 271 isolate, currentWorldType); |
| 272 {% endfilter %} | 272 {% endfilter %} |
| 273 | 273 |
| 274 UNUSED_PARAM(defaultSignature); | |
| 275 {% if has_constructor %} | 274 {% if has_constructor %} |
| 276 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); | 275 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); |
| 277 {# FIXME: compute length #} | 276 {# FIXME: compute length #} |
| 278 functionTemplate->SetLength(0); | 277 functionTemplate->SetLength(0); |
| 279 {% endif %} | 278 {% endif %} |
| 280 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); | 279 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); |
| 281 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); | 280 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); |
| 282 UNUSED_PARAM(instanceTemplate); | |
| 283 UNUSED_PARAM(prototypeTemplate); | |
| 284 {% if is_check_security and interface_name != 'Window' %} | 281 {% if is_check_security and interface_name != 'Window' %} |
| 285 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); | 282 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); |
| 286 {% endif %} | 283 {% endif %} |
| 287 {% for attribute in attributes if attribute.runtime_enabled_function %} | 284 {% for attribute in attributes if attribute.runtime_enabled_function %} |
| 288 {% filter conditional(attribute.conditional_string) %} | 285 {% filter conditional(attribute.conditional_string) %} |
| 289 if ({{attribute.runtime_enabled_function}}()) { | 286 if ({{attribute.runtime_enabled_function}}()) { |
| 290 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | 287 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ |
| 291 {{attribute_configuration(attribute)}}; | 288 {{attribute_configuration(attribute)}}; |
| 292 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); | 289 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); |
| 293 } | 290 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 | 470 |
| 474 {% endif %} | 471 {% endif %} |
| 475 {% endblock %} | 472 {% endblock %} |
| 476 | 473 |
| 477 | 474 |
| 478 {##############################################################################} | 475 {##############################################################################} |
| 479 {% block install_per_context_methods %} | 476 {% block install_per_context_methods %} |
| 480 {% if has_per_context_enabled_methods %} | 477 {% if has_per_context_enabled_methods %} |
| 481 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot ypeTemplate, v8::Isolate* isolate) | 478 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot ypeTemplate, v8::Isolate* isolate) |
| 482 { | 479 { |
| 483 UNUSED_PARAM(prototypeTemplate); | |
| 484 {# Define per-context enabled operations #} | 480 {# Define per-context enabled operations #} |
| 485 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, GetT emplate(isolate, worldType(isolate))); | 481 v8::Local<v8::Signature> ALLOW_UNUSED defaultSignature = v8::Signature::New( isolate, GetTemplate(isolate, worldType(isolate))); |
|
Inactive
2013/12/09 15:24:47
Nit: We probably don't need ALLOW_UNUSED here beca
| |
| 486 UNUSED_PARAM(defaultSignature); | |
| 487 | 482 |
| 488 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext()); | 483 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext()); |
| 489 {% for method in methods if method.per_context_enabled_function %} | 484 {% for method in methods if method.per_context_enabled_function %} |
| 490 if (context && context->isDocument() && {{method.per_context_enabled_functio n}}(toDocument(context))) | 485 if (context && context->isDocument() && {{method.per_context_enabled_functio n}}(toDocument(context))) |
| 491 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "{{method.name}} ", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, {{cpp_cl ass}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); | 486 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "{{method.name}} ", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, {{cpp_cl ass}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); |
| 492 {% endfor %} | 487 {% endfor %} |
| 493 } | 488 } |
| 494 | 489 |
| 495 {% endif %} | 490 {% endif %} |
| 496 {% endblock %} | 491 {% endblock %} |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 fromInternalPointer(object)->deref(); | 560 fromInternalPointer(object)->deref(); |
| 566 } | 561 } |
| 567 | 562 |
| 568 template<> | 563 template<> |
| 569 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) | 564 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) |
| 570 { | 565 { |
| 571 return toV8(impl, creationContext, isolate); | 566 return toV8(impl, creationContext, isolate); |
| 572 } | 567 } |
| 573 | 568 |
| 574 {% endblock %} | 569 {% endblock %} |
| OLD | NEW |