| OLD | NEW |
| 1 {% from 'conversions.cpp' import declare_enum_validation_variable %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable %} |
| 2 {% include 'copyright_block.txt' %} | 2 {% include 'copyright_block.txt' %} |
| 3 #include "config.h" | 3 #include "config.h" |
| 4 #include "{{v8_original_class}}.h" | 4 #include "{{v8_original_class}}.h" |
| 5 | 5 |
| 6 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} | 6 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} |
| 7 #include "{{filename}}" | 7 #include "{{filename}}" |
| 8 {% endfor %} | 8 {% endfor %} |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 if (!toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate)) | 92 if (!toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate)) |
| 93 return v8::Local<v8::Value>(); | 93 return v8::Local<v8::Value>(); |
| 94 {% endif %} | 94 {% endif %} |
| 95 if (!toV8{{cpp_class}}(impl, v8Object, creationContext, isolate)) | 95 if (!toV8{{cpp_class}}(impl, v8Object, creationContext, isolate)) |
| 96 return v8::Local<v8::Value>(); | 96 return v8::Local<v8::Value>(); |
| 97 return v8Object; | 97 return v8Object; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Local<v8::Object> dictiona
ry, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) | 100 bool toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Local<v8::Object> dictiona
ry, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 101 { | 101 { |
| 102 // TODO(bashi): Use ForceSet() instead of Set(). http://crbug.com/476720 | |
| 103 {% for member in members %} | 102 {% for member in members %} |
| 104 if (impl.{{member.has_method_name}}()) { | 103 if (impl.{{member.has_method_name}}()) { |
| 105 {% if member.is_object %} | 104 {% if member.is_object %} |
| 106 ASSERT(impl.{{member.cpp_name}}().isObject()); | 105 ASSERT(impl.{{member.cpp_name}}().isObject()); |
| 107 {% endif %} | 106 {% endif %} |
| 108 if (!v8CallBoolean(dictionary->Set(isolate->GetCurrentContext(), v8Strin
g(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}}))) | 107 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon
text(), v8String(isolate, "{{member.name}}"), {{member.cpp_value_to_v8_value}}))
) |
| 109 return false; | 108 return false; |
| 110 {% if member.v8_default_value %} | 109 {% if member.v8_default_value %} |
| 111 } else { | 110 } else { |
| 112 if (!v8CallBoolean(dictionary->Set(isolate->GetCurrentContext(), v8Strin
g(isolate, "{{member.name}}"), {{member.v8_default_value}}))) | 111 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentCon
text(), v8String(isolate, "{{member.name}}"), {{member.v8_default_value}}))) |
| 113 return false; | 112 return false; |
| 114 {% elif member.is_required %} | 113 {% elif member.is_required %} |
| 115 } else { | 114 } else { |
| 116 ASSERT_NOT_REACHED(); | 115 ASSERT_NOT_REACHED(); |
| 117 {% endif %} | 116 {% endif %} |
| 118 } | 117 } |
| 119 | 118 |
| 120 {% endfor %} | 119 {% endfor %} |
| 121 return true; | 120 return true; |
| 122 } | 121 } |
| 123 | 122 |
| 124 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) | 123 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate
, v8::Local<v8::Value> value, ExceptionState& exceptionState) |
| 125 { | 124 { |
| 126 {{cpp_class}} impl; | 125 {{cpp_class}} impl; |
| 127 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); | 126 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); |
| 128 return impl; | 127 return impl; |
| 129 } | 128 } |
| 130 | 129 |
| 131 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |