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

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

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years 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 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 {% elif argument.is_variadic_wrapper_type %} 156 {% elif argument.is_variadic_wrapper_type %}
157 for (int i = {{argument.index}}; i < info.Length(); ++i) { 157 for (int i = {{argument.index}}; i < info.Length(); ++i) {
158 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { 158 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) {
159 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % 159 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
160 (argument.index + 1, argument.idl_type)) | in dent(8)}} 160 (argument.index + 1, argument.idl_type)) | in dent(8)}}
161 return; 161 return;
162 } 162 }
163 {{argument.name}}.append(V8{{argument.idl_type}}::toImpl(v8::Handle<v8::Obje ct>::Cast(info[i]))); 163 {{argument.name}}.append(V8{{argument.idl_type}}::toImpl(v8::Handle<v8::Obje ct>::Cast(info[i])));
164 } 164 }
165 {% elif argument.is_dictionary %} 165 {% elif argument.is_dictionary %}
166 {% if not argument.use_permissive_dictionary_conversion %}
166 {# Dictionaries must have type Undefined, Null or Object: 167 {# Dictionaries must have type Undefined, Null or Object:
167 http://heycam.github.io/webidl/#es-dictionary #} 168 http://heycam.github.io/webidl/#es-dictionary #}
168 if (!isUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->I sObject()) { 169 if (!isUndefinedOrNull(info[{{argument.index}}]) && !info[{{argument.index}}]->I sObject()) {
169 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' % 170 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' %
170 (argument.index + 1, argument.name)) | indent}} 171 (argument.index + 1, argument.name)) | indent}}
171 return; 172 return;
172 } 173 }
174 {% endif %}{# not argument.use_permissive_dictionary_conversion #}
173 {{argument.v8_value_to_local_cpp_value}}; 175 {{argument.v8_value_to_local_cpp_value}};
174 {% else %}{# argument.is_nullable #} 176 {% else %}{# argument.is_nullable #}
175 {{argument.v8_value_to_local_cpp_value}}; 177 {{argument.v8_value_to_local_cpp_value}};
176 {% endif %}{# argument.is_nullable #} 178 {% endif %}{# argument.is_nullable #}
177 {# Type checking, possibly throw a TypeError, per: 179 {# Type checking, possibly throw a TypeError, per:
178 http://www.w3.org/TR/WebIDL/#es-type-mapping #} 180 http://www.w3.org/TR/WebIDL/#es-type-mapping #}
179 {% if argument.has_type_checking_unrestricted %} 181 {% if argument.has_type_checking_unrestricted %}
180 {# Non-finite floating point values (NaN, +Infinity or −Infinity), per: 182 {# Non-finite floating point values (NaN, +Infinity or −Infinity), per:
181 http://heycam.github.io/webidl/#es-float 183 http://heycam.github.io/webidl/#es-float
182 http://heycam.github.io/webidl/#es-double #} 184 http://heycam.github.io/webidl/#es-double #}
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 {% filter exposed(method.exposed_test) %} 647 {% filter exposed(method.exposed_test) %}
646 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all if m ethod.overloads else method.runtime_enabled_function) %} 648 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all if m ethod.overloads else method.runtime_enabled_function) %}
647 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction()); 649 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction());
648 {% endfilter %} 650 {% endfilter %}
649 {% endfilter %} 651 {% endfilter %}
650 {% endfilter %} 652 {% endfilter %}
651 {% endfor %} 653 {% endfor %}
652 {% endif %} 654 {% endif %}
653 } 655 }
654 {%- endmacro %} 656 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/dictionary_v8.cpp ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698