| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 impl.setBoolean(v8Value->BooleanValue()); | 174 impl.setBoolean(v8Value->BooleanValue()); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 | 177 |
| 178 {% else %} | 178 {% else %} |
| 179 {# 18. TypeError #} | 179 {# 18. TypeError #} |
| 180 exceptionState.throwTypeError("The provided value is not of type '{{type_strin
g}}'"); | 180 exceptionState.throwTypeError("The provided value is not of type '{{type_strin
g}}'"); |
| 181 {% endif %} | 181 {% endif %} |
| 182 } | 182 } |
| 183 | 183 |
| 184 v8::Local<v8::Value> toV8(const {{cpp_class}}& impl, v8::Local<v8::Object> creat
ionContext, v8::Isolate* isolate) { | 184 v8::Local<v8::Value> ToV8(const {{cpp_class}}& impl, v8::Local<v8::Object> creat
ionContext, v8::Isolate* isolate) { |
| 185 switch (impl.m_type) { | 185 switch (impl.m_type) { |
| 186 case {{cpp_class}}::SpecificTypeNone: | 186 case {{cpp_class}}::SpecificTypeNone: |
| 187 {# FIXME: We might want to return undefined in some cases #} | 187 {# FIXME: We might want to return undefined in some cases #} |
| 188 return v8::Null(isolate); | 188 return v8::Null(isolate); |
| 189 {% for member in members %} | 189 {% for member in members %} |
| 190 case {{cpp_class}}::{{member.specific_type_enum}}: | 190 case {{cpp_class}}::{{member.specific_type_enum}}: |
| 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::NotNullabl
e, 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 |