Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
| 3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
| 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {% if method.number_of_required_arguments %} | 10 {% if method.number_of_required_arguments %} |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 {% for argument in constructor.arguments %} | 379 {% for argument in constructor.arguments %} |
| 380 {{generate_argument(constructor, argument) | indent}} | 380 {{generate_argument(constructor, argument) | indent}} |
| 381 {% endfor %} | 381 {% endfor %} |
| 382 {% if is_constructor_call_with_execution_context %} | 382 {% if is_constructor_call_with_execution_context %} |
| 383 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); | 383 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
| 384 {% endif %} | 384 {% endif %} |
| 385 {% if is_constructor_call_with_document %} | 385 {% if is_constructor_call_with_document %} |
| 386 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ; | 386 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ; |
| 387 {% endif %} | 387 {% endif %} |
| 388 {{ref_ptr}}<{{cpp_class}}> impl = {{cpp_class}}::create({{constructor.argume nt_list | join(', ')}}); | 388 {{ref_ptr}}<{{cpp_class}}> impl = {{cpp_class}}::create({{constructor.argume nt_list | join(', ')}}); |
| 389 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 390 {% if is_constructor_raises_exception %} | 389 {% if is_constructor_raises_exception %} |
| 391 if (exceptionState.throwIfNeeded()) | 390 if (exceptionState.throwIfNeeded()) |
| 392 return; | 391 return; |
| 393 {% endif %} | 392 {% endif %} |
| 394 | 393 |
| 394 {% if has_custom_wrap %} | |
| 395 v8SetReturnValue(info, wrap(impl.get(), info.Holder(), info.GetIsolate())); | |
| 396 {% else %} | |
| 397 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 395 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configuration}} ); | 398 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configuration}} ); |
| 396 v8SetReturnValue(info, wrapper); | 399 v8SetReturnValue(info, wrapper); |
|
Nils Barth (inactive)
2014/03/24 08:50:26
I don't follow how this differs from what I commit
Nils Barth (inactive)
2014/03/24 08:55:00
OIC, I did it for *named* constructors.
Could you
| |
| 400 {% endif %} | |
| 397 } | 401 } |
| 398 {% endmacro %} | 402 {% endmacro %} |
| 399 | 403 |
| 400 | 404 |
| 401 {##############################################################################} | 405 {##############################################################################} |
| 402 {% macro named_constructor_callback(constructor) %} | 406 {% macro named_constructor_callback(constructor) %} |
| 403 static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) | 407 static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) |
| 404 { | 408 { |
| 405 if (!info.IsConstructCall()) { | 409 if (!info.IsConstructCall()) { |
| 406 throwTypeError(ExceptionMessages::failedToConstruct("{{constructor.name} }", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate()); | 410 throwTypeError(ExceptionMessages::failedToConstruct("{{constructor.name} }", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 | 445 |
| 442 {% if has_custom_wrap %} | 446 {% if has_custom_wrap %} |
| 443 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso late()); | 447 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso late()); |
| 444 {% else %} | 448 {% else %} |
| 445 v8::Handle<v8::Object> wrapper = info.Holder(); | 449 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 446 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_conf iguration}}); | 450 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_conf iguration}}); |
| 447 {% endif %} | 451 {% endif %} |
| 448 v8SetReturnValue(info, wrapper); | 452 v8SetReturnValue(info, wrapper); |
| 449 } | 453 } |
| 450 {% endmacro %} | 454 {% endmacro %} |
| OLD | NEW |