| OLD | NEW |
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 {% endfor %} | 62 {% endfor %} |
| 63 } | 63 } |
| 64 | 64 |
| 65 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{
cpp_class}}& impl, UnionTypeConversionMode conversionMode, ExceptionState& excep
tionState) { | 65 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{
cpp_class}}& impl, UnionTypeConversionMode conversionMode, ExceptionState& excep
tionState) { |
| 66 if (v8Value.IsEmpty()) | 66 if (v8Value.IsEmpty()) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 {# The numbers in the following comments refer to the steps described in | 69 {# The numbers in the following comments refer to the steps described in |
| 70 http://heycam.github.io/webidl/#es-union #} | 70 http://heycam.github.io/webidl/#es-union #} |
| 71 {# 1. null or undefined #} | 71 {# 1. null or undefined #} |
| 72 if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v
8Value)) | 72 if (conversionMode == UnionTypeConversionMode::kNullable && isUndefinedOrNull(
v8Value)) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 {% if dictionary_type %} | 75 {% if dictionary_type %} |
| 76 {# 3. Dictionaries for null or undefined #} | 76 {# 3. Dictionaries for null or undefined #} |
| 77 if (isUndefinedOrNull(v8Value)) { | 77 if (isUndefinedOrNull(v8Value)) { |
| 78 {{v8_value_to_local_cpp_value(dictionary_type) | indent}} | 78 {{v8_value_to_local_cpp_value(dictionary_type) | indent}} |
| 79 impl.set{{dictionary_type.type_name}}(cppValue); | 79 impl.set{{dictionary_type.type_name}}(cppValue); |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 | 82 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return {{member.cpp_value_to_v8_value}}; | 191 return {{member.cpp_value_to_v8_value}}; |
| 192 {% endfor %} | 192 {% endfor %} |
| 193 default: | 193 default: |
| 194 NOTREACHED(); | 194 NOTREACHED(); |
| 195 } | 195 } |
| 196 return v8::Local<v8::Value>(); | 196 return v8::Local<v8::Value>(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) { | 199 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) { |
| 200 {{cpp_class}} impl; | 200 {{cpp_class}} impl; |
| 201 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullabl
e, exceptionState); | 201 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab
le, exceptionState); |
| 202 return impl; | 202 return impl; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace blink | 205 } // namespace blink |
| 206 | 206 |
| 207 {% endfilter %}{# format_blink_cpp_source_code #} | 207 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |