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

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

Issue 144463014: Add [StrictTypeChecking] to the SVGGeometryElement interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop/change TC; Simplify generated code. Created 6 years, 10 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 {% if method.has_exception_state %} 6 {% if method.has_exception_state %}
7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
8 {% endif %} 8 {% endif %}
9 {% if method.name in ['addEventListener', 'removeEventListener'] %} 9 {% if method.name in ['addEventListener', 'removeEventListener'] %}
10 {{add_remove_event_listener_method(method.name) | indent}} 10 {{add_remove_event_listener_method(method.name) | indent}}
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}} 90 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}}
91 {% else %} 91 {% else %}
92 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}} 92 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}}
93 {% endif %} 93 {% endif %}
94 return; 94 return;
95 } 95 }
96 {% endif %} 96 {% endif %}
97 {% if method.is_strict_type_checking and argument.is_wrapper_type %} 97 {% if method.is_strict_type_checking and argument.is_wrapper_type %}
98 {# Type checking for wrapper interface types (if interface not implemented, 98 {# Type checking for wrapper interface types (if interface not implemented,
99 throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 99 throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
100 if (info.Length() > {{argument.index}} && !{% if argument.is_nullable %}isUndefi nedOrNull(info[{{argument.index}}]){% else %}info[{{argument.index}}]->IsUndefin ed(){% endif %} && !V8{{argument.idl_type}}::hasInstance(info[{{argument.index}} ], info.GetIsolate())) { 100 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) {
101 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % 101 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
102 (argument.index + 1, argument.idl_type)) | indent }} 102 (argument.index + 1, argument.idl_type)) | indent }}
103 return; 103 return;
104 } 104 }
105 {% endif %} 105 {% endif %}
106 {% if argument.is_callback_interface %} 106 {% if argument.is_callback_interface %}
107 {% if argument.is_optional %} 107 {% if argument.is_optional %}
108 OwnPtr<{{argument.idl_type}}> {{argument.name}}; 108 OwnPtr<{{argument.idl_type}}> {{argument.name}};
109 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) { 109 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) {
110 if (!info[{{argument.index}}]->IsFunction()) { 110 if (!info[{{argument.index}}]->IsFunction()) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 v8::Handle<v8::Object> wrapper = info.Holder(); 424 v8::Handle<v8::Object> wrapper = info.Holder();
425 {% if is_constructor_raises_exception %} 425 {% if is_constructor_raises_exception %}
426 if (exceptionState.throwIfNeeded()) 426 if (exceptionState.throwIfNeeded())
427 return; 427 return;
428 {% endif %} 428 {% endif %}
429 429
430 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent); 430 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8 _class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu ration::Dependent);
431 v8SetReturnValue(info, wrapper); 431 v8SetReturnValue(info, wrapper);
432 } 432 }
433 {% endmacro %} 433 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/tests/results/V8TestInterfacePython.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698