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 |
395 {# FIXME: Should probably be Independent unless [ActiveDOMObject] | 394 {% if has_custom_wrap %} |
396 or [DependentLifetime]. #} | 395 v8SetReturnValue(info, wrap(impl.get(), info.Holder(), info.GetIsolate())); |
397 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dep endent); | 396 {% else %} |
397 v8::Handle<v8::Object> wrapper = info.Holder(); | |
398 {% set wrapper_configuration = 'WrapperConfiguration::Dependent' | |
Nils Barth (inactive)
2014/03/24 02:14:20
Since we're using {{wrapper_configuration}} two pl
| |
399 if (has_visit_dom_wrapper or | |
400 is_active_dom_object or | |
401 is_dependent_lifetime) else | |
402 'WrapperConfiguration::Independent' %} | |
403 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configuration}} ); | |
398 v8SetReturnValue(info, wrapper); | 404 v8SetReturnValue(info, wrapper); |
405 {% endif %} | |
399 } | 406 } |
400 {% endmacro %} | 407 {% endmacro %} |
401 | 408 |
402 | 409 |
403 {##############################################################################} | 410 {##############################################################################} |
404 {% macro named_constructor_callback(constructor) %} | 411 {% macro named_constructor_callback(constructor) %} |
405 static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) | 412 static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) |
406 { | 413 { |
407 if (!info.IsConstructCall()) { | 414 if (!info.IsConstructCall()) { |
408 throwTypeError(ExceptionMessages::failedToConstruct("{{constructor.name} }", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate()); | 415 throwTypeError(ExceptionMessages::failedToConstruct("{{constructor.name} }", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate()); |
(...skipping 30 matching lines...) Expand all Loading... | |
439 v8::Handle<v8::Object> wrapper = info.Holder(); | 446 v8::Handle<v8::Object> wrapper = info.Holder(); |
440 {% if is_constructor_raises_exception %} | 447 {% if is_constructor_raises_exception %} |
441 if (exceptionState.throwIfNeeded()) | 448 if (exceptionState.throwIfNeeded()) |
442 return; | 449 return; |
443 {% endif %} | 450 {% endif %} |
444 | 451 |
445 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent); | 452 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent); |
446 v8SetReturnValue(info, wrapper); | 453 v8SetReturnValue(info, wrapper); |
447 } | 454 } |
448 {% endmacro %} | 455 {% endmacro %} |
OLD | NEW |