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

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: 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 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Local< v8::Object>::Cast(v8Value)); 10 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Local< v8::Object>::Cast(v8Value));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 {% endif %} 93 {% endif %}
94 {# 9., 10. ArrayBufferView #} 94 {# 9., 10. ArrayBufferView #}
95 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren\'t supported yet. #} 95 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren\'t supported yet. #}
96 {% if array_buffer_view_type %} 96 {% if array_buffer_view_type %}
97 {{assign_and_return_if_hasinstance(array_buffer_view_type) | indent(2)}} 97 {{assign_and_return_if_hasinstance(array_buffer_view_type) | indent(2)}}
98 98
99 {% endif %} 99 {% endif %}
100 {% if array_or_sequence_type %} 100 {% if array_or_sequence_type %}
101 {# 11.1, 11.2. Arrays and Sequences #} 101 {# 11.1, 11.2. Arrays and Sequences #}
102 {# FIXME: This should also check "object but not RegExp". Add checks 102 if (IsV8Sequence(v8Value, isolate, exceptionState)) {
103 when we implement conversions for Date and RegExp. #}
104 {# TODO(bashi): Should check @@iterator symbol instead. #}
105 if (v8Value->IsArray()) {
106 {{v8_value_to_local_cpp_value(array_or_sequence_type) | indent}} 103 {{v8_value_to_local_cpp_value(array_or_sequence_type) | indent}}
107 impl.set{{array_or_sequence_type.type_name}}(cppValue); 104 impl.set{{array_or_sequence_type.type_name}}(cppValue);
108 return; 105 return;
109 } 106 }
110 107
111 {% endif %} 108 {% endif %}
112 {% if dictionary_type %} 109 {% if dictionary_type %}
113 {# 11.3. Dictionaries #} 110 {# 11.3. Dictionaries #}
114 if (v8Value->IsObject()) { 111 if (v8Value->IsObject()) {
115 {{v8_value_to_local_cpp_value(dictionary_type) | indent}} 112 {{v8_value_to_local_cpp_value(dictionary_type) | indent}}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 204
208 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) { 205 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) {
209 {{cpp_class}} impl; 206 {{cpp_class}} impl;
210 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState); 207 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState);
211 return impl; 208 return impl;
212 } 209 }
213 210
214 } // namespace blink 211 } // namespace blink
215 212
216 {% endfilter %}{# format_blink_cpp_source_code #} 213 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698