| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! | 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "{{header_filename}}" | 8 #include "{{header_filename}}" |
| 9 | 9 |
| 10 {% macro assign_and_return_if_hasinstance(member) %} | 10 {% macro assign_and_return_if_hasinstance(member) %} |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 {% for member in container.members %} | 29 {% for member in container.members %} |
| 30 {{member.rvalue_cpp_type}} {{container.cpp_class}}::getAs{{member.type_name}}()
const | 30 {{member.rvalue_cpp_type}} {{container.cpp_class}}::getAs{{member.type_name}}()
const |
| 31 { | 31 { |
| 32 ASSERT(is{{member.type_name}}()); | 32 ASSERT(is{{member.type_name}}()); |
| 33 return m_{{member.cpp_name}}; | 33 return m_{{member.cpp_name}}; |
| 34 } | 34 } |
| 35 | 35 |
| 36 void {{container.cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}}
value) | 36 void {{container.cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}}
value) |
| 37 { | 37 { |
| 38 ASSERT(isNull()); | 38 ASSERT(isNull()); |
| 39 {% if member.enum_validation_expression %} |
| 40 String string = value; |
| 41 if (!({{member.enum_validation_expression}})) { |
| 42 ASSERT_NOT_REACHED(); |
| 43 return; |
| 44 } |
| 45 {% endif %} |
| 39 m_{{member.cpp_name}} = value; | 46 m_{{member.cpp_name}} = value; |
| 40 m_type = {{member.specific_type_enum}}; | 47 m_type = {{member.specific_type_enum}}; |
| 41 } | 48 } |
| 42 | 49 |
| 43 {% endfor %} | 50 {% endfor %} |
| 44 {% if container.needs_trace %} | 51 {% if container.needs_trace %} |
| 45 void {{container.cpp_class}}::trace(Visitor* visitor) | 52 void {{container.cpp_class}}::trace(Visitor* visitor) |
| 46 { | 53 { |
| 47 {% for member in container.members if member.is_traceable %} | 54 {% for member in container.members if member.is_traceable %} |
| 48 visitor->trace(m_{{member.cpp_name}}); | 55 visitor->trace(m_{{member.cpp_name}}); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 {{container.numeric_type.v8_value_to_local_cpp_value}}; | 124 {{container.numeric_type.v8_value_to_local_cpp_value}}; |
| 118 impl.set{{container.numeric_type.type_name}}(cppValue); | 125 impl.set{{container.numeric_type.type_name}}(cppValue); |
| 119 return; | 126 return; |
| 120 } | 127 } |
| 121 | 128 |
| 122 {% endif %} | 129 {% endif %} |
| 123 {% if container.string_type %} | 130 {% if container.string_type %} |
| 124 {# 16. String #} | 131 {# 16. String #} |
| 125 { | 132 { |
| 126 {{container.string_type.v8_value_to_local_cpp_value}}; | 133 {{container.string_type.v8_value_to_local_cpp_value}}; |
| 134 {% if container.string_type.enum_validation_expression %} |
| 135 String string = cppValue; |
| 136 if (!({{container.string_type.enum_validation_expression}})) { |
| 137 exceptionState.throwTypeError("'" + string + "' is not a valid enum
value."); |
| 138 return; |
| 139 } |
| 140 {% endif %} |
| 127 impl.set{{container.string_type.type_name}}(cppValue); | 141 impl.set{{container.string_type.type_name}}(cppValue); |
| 128 return; | 142 return; |
| 129 } | 143 } |
| 130 | 144 |
| 131 {# 17. Number (fallback) #} | 145 {# 17. Number (fallback) #} |
| 132 {% elif container.numeric_type %} | 146 {% elif container.numeric_type %} |
| 133 { | 147 { |
| 134 {{container.numeric_type.v8_value_to_local_cpp_value}}; | 148 {{container.numeric_type.v8_value_to_local_cpp_value}}; |
| 135 impl.set{{container.numeric_type.type_name}}(cppValue); | 149 impl.set{{container.numeric_type.type_name}}(cppValue); |
| 136 return; | 150 return; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 167 | 181 |
| 168 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue(
const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& excepti
onState) | 182 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue(
const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& excepti
onState) |
| 169 { | 183 { |
| 170 {{container.cpp_class}} impl; | 184 {{container.cpp_class}} impl; |
| 171 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); | 185 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); |
| 172 return impl; | 186 return impl; |
| 173 } | 187 } |
| 174 | 188 |
| 175 {% endfor %} | 189 {% endfor %} |
| 176 } // namespace blink | 190 } // namespace blink |
| OLD | NEW |