Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/bindings/templates/methods.cpp

Issue 206793006: Add support for [Constructor, Custom=Wrap] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 {{throw_type_error(constructor, 427 {{throw_type_error(constructor,
428 'ExceptionMessages::notEnoughArguments(%s, info.Length())' % 428 'ExceptionMessages::notEnoughArguments(%s, info.Length())' %
429 constructor.number_of_required_arguments) | indent(8)}} 429 constructor.number_of_required_arguments) | indent(8)}}
430 return; 430 return;
431 } 431 }
432 {% endif %} 432 {% endif %}
433 {% for argument in constructor.arguments %} 433 {% for argument in constructor.arguments %}
434 {{generate_argument(constructor, argument) | indent}} 434 {{generate_argument(constructor, argument) | indent}}
435 {% endfor %} 435 {% endfor %}
436 RefPtr<{{cpp_class}}> impl = {{cpp_class}}::createForJSConstructor({{constru ctor.argument_list | join(', ')}}); 436 RefPtr<{{cpp_class}}> impl = {{cpp_class}}::createForJSConstructor({{constru ctor.argument_list | join(', ')}});
437 v8::Handle<v8::Object> wrapper = info.Holder();
438 {% if is_constructor_raises_exception %} 437 {% if is_constructor_raises_exception %}
439 if (exceptionState.throwIfNeeded()) 438 if (exceptionState.throwIfNeeded())
440 return; 439 return;
441 {% endif %} 440 {% endif %}
442 441
442 {% if has_custom_wrap %}
sof 2014/03/24 08:16:10 This isn't complete; the constructor overloads nee
Nils Barth (inactive) 2014/03/24 08:49:11 I don't follow; I rearranged the original CL sligh
443 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso late());
444 {% else %}
445 v8::Handle<v8::Object> wrapper = info.Holder();
443 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_conf iguration}}); 446 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_conf iguration}});
Nils Barth (inactive) 2014/03/24 03:13:19 BTW, the custom wrap() means we don't need to call
haraken 2014/03/24 03:32:44 Right. The custom wrap() should be already calling
Nils Barth (inactive) 2014/03/24 03:33:45 Got it; self-explanatory, so no comment needed.
447 {% endif %}
444 v8SetReturnValue(info, wrapper); 448 v8SetReturnValue(info, wrapper);
445 } 449 }
446 {% endmacro %} 450 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698