| OLD | NEW |
| 1 {% filter format_blink_cpp_source_code %} | 1 {% filter format_blink_cpp_source_code %} |
| 2 | 2 |
| 3 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %} | 3 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %} |
| 4 {% include 'copyright_block.txt' %} | 4 {% include 'copyright_block.txt' %} |
| 5 #include "{{v8_original_class}}.h" | 5 #include "{{v8_original_class}}.h" |
| 6 | 6 |
| 7 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} | 7 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} |
| 8 #include "{{filename}}" | 8 #include "{{filename}}" |
| 9 {% endfor %} | 9 {% endfor %} |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 v8::TryCatch block(isolate); | 39 v8::TryCatch block(isolate); |
| 40 v8::Local<v8::Object> v8Object; | 40 v8::Local<v8::Object> v8Object; |
| 41 if (!v8Call(v8Value->ToObject(isolate->GetCurrentContext()), v8Object, block))
{ | 41 if (!v8Call(v8Value->ToObject(isolate->GetCurrentContext()), v8Object, block))
{ |
| 42 exceptionState.rethrowV8Exception(block.Exception()); | 42 exceptionState.rethrowV8Exception(block.Exception()); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 {% endif %} | 45 {% endif %} |
| 46 {% for member in members %} | 46 {% for member in members %} |
| 47 {% filter runtime_enabled(member.runtime_enabled_feature_name) %} | 47 {% filter runtime_enabled(member.runtime_enabled_feature_name) %} |
| 48 v8::Local<v8::Value> {{member.name}}Value; | 48 v8::Local<v8::Value> {{member.name}}Value; |
| 49 if (!v8Object->Get(isolate->GetCurrentContext(), v8String(isolate, "{{member.n
ame}}")).ToLocal(&{{member.name}}Value)) { | 49 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "{{me
mber.name}}")).ToLocal(&{{member.name}}Value)) { |
| 50 exceptionState.rethrowV8Exception(block.Exception()); | 50 exceptionState.rethrowV8Exception(block.Exception()); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) { | 53 if ({{member.name}}Value.IsEmpty() || {{member.name}}Value->IsUndefined()) { |
| 54 {% if member.is_required %} | 54 {% if member.is_required %} |
| 55 exceptionState.throwTypeError("required member {{member.name}} is undefined.
"); | 55 exceptionState.throwTypeError("required member {{member.name}} is undefined.
"); |
| 56 return; | 56 return; |
| 57 {% else %} | 57 {% else %} |
| 58 // Do nothing. | 58 // Do nothing. |
| 59 {% endif %} | 59 {% endif %} |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 {% if parent_v8_class %} | 100 {% if parent_v8_class %} |
| 101 if (!toV8{{parent_cpp_class}}(impl, dictionary, creationContext, isolate)) | 101 if (!toV8{{parent_cpp_class}}(impl, dictionary, creationContext, isolate)) |
| 102 return false; | 102 return false; |
| 103 | 103 |
| 104 {% endif %} | 104 {% endif %} |
| 105 {% for member in members %} | 105 {% for member in members %} |
| 106 if (impl.{{member.has_method_name}}()) { | 106 if (impl.{{member.has_method_name}}()) { |
| 107 {% if member.is_object %} | 107 {% if member.is_object %} |
| 108 DCHECK(impl.{{member.getter_name}}().isObject()); | 108 DCHECK(impl.{{member.getter_name}}().isObject()); |
| 109 {% endif %} | 109 {% endif %} |
| 110 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}}))) | 110 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}}
))) |
| 111 return false; | 111 return false; |
| 112 {% if member.v8_default_value %} | 112 {% if member.v8_default_value %} |
| 113 } else { | 113 } else { |
| 114 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}}))) | 114 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "{{member.name}}"), {{member.v8_default_value}}))) |
| 115 return false; | 115 return false; |
| 116 {% elif member.is_nullable %} | 116 {% elif member.is_nullable %} |
| 117 } else { | 117 } else { |
| 118 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8String(isolate, "{{member.name}}"), v8::Null(isolate)))) | 118 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "{{member.name}}"), v8::Null(isolate)))) |
| 119 return false; | 119 return false; |
| 120 {% elif member.is_required %} | 120 {% elif member.is_required %} |
| 121 } else { | 121 } else { |
| 122 NOTREACHED(); | 122 NOTREACHED(); |
| 123 {% endif %} | 123 {% endif %} |
| 124 } | 124 } |
| 125 | 125 |
| 126 {% endfor %} | 126 {% endfor %} |
| 127 return true; | 127 return true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) { | 130 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) { |
| 131 {{cpp_class}} impl; | 131 {{cpp_class}} impl; |
| 132 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); | 132 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); |
| 133 return impl; | 133 return impl; |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| 137 | 137 |
| 138 {% endfilter %}{# format_blink_cpp_source_code #} | 138 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |