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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl

Issue 2810843002: bindings: Make the sequence conversion code more complaint with WebIDL. (Closed)
Patch Set: Adjust even more tests Created 3 years, 8 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
OLDNEW
1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %}
2 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %} 2 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
3 {#############################################################################} 3 {#############################################################################}
4 {% macro assign_and_return_if_hasinstance(member) %} 4 {% macro assign_and_return_if_hasinstance(member) %}
5 {% if member.is_array_buffer_or_view_type %} 5 {% if member.is_array_buffer_or_view_type %}
6 if (v8Value->Is{{member.type_name}}()) { 6 if (v8Value->Is{{member.type_name}}()) {
7 {% else %} 7 {% else %}
8 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { 8 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) {
9 {% endif %} 9 {% endif %}
10 {% if member.is_array_buffer_view_or_typed_array %} 10 {% if member.is_array_buffer_view_or_typed_array %}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 {% endif %} 103 {% endif %}
104 {# 9., 10. ArrayBufferView #} 104 {# 9., 10. ArrayBufferView #}
105 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren\'t supported yet. #} 105 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren\'t supported yet. #}
106 {% if array_buffer_view_type %} 106 {% if array_buffer_view_type %}
107 {{assign_and_return_if_hasinstance(array_buffer_view_type) | indent(2)}} 107 {{assign_and_return_if_hasinstance(array_buffer_view_type) | indent(2)}}
108 108
109 {% endif %} 109 {% endif %}
110 {% if array_or_sequence_type %} 110 {% if array_or_sequence_type %}
111 {# 11.1, 11.2. Arrays and Sequences #} 111 {# 11.1, 11.2. Arrays and Sequences #}
112 {# FIXME: This should also check "object but not RegExp". Add checks 112 if (IsV8Sequence(isolate, v8Value, exceptionState)) {
113 when we implement conversions for Date and RegExp. #}
114 {# TODO(bashi): Should check @@iterator symbol instead. #}
115 if (v8Value->IsArray()) {
116 {{v8_value_to_local_cpp_value(array_or_sequence_type) | indent}} 113 {{v8_value_to_local_cpp_value(array_or_sequence_type) | indent}}
117 impl.set{{array_or_sequence_type.type_name}}(cppValue); 114 impl.set{{array_or_sequence_type.type_name}}(cppValue);
118 return; 115 return;
119 } 116 }
120 117
121 {% endif %} 118 {% endif %}
122 {% if dictionary_type %} 119 {% if dictionary_type %}
123 {# 11.3. Dictionaries #} 120 {# 11.3. Dictionaries #}
124 if (v8Value->IsObject()) { 121 if (v8Value->IsObject()) {
125 {{v8_value_to_local_cpp_value(dictionary_type) | indent}} 122 {{v8_value_to_local_cpp_value(dictionary_type) | indent}}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 214
218 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) { 215 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) {
219 {{cpp_class}} impl; 216 {{cpp_class}} impl;
220 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState); 217 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState);
221 return impl; 218 return impl;
222 } 219 }
223 220
224 } // namespace blink 221 } // namespace blink
225 222
226 {% endfilter %}{# format_blink_cpp_source_code #} 223 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698