| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 {# 18. Boolean (fallback) #} | 127 {# 18. Boolean (fallback) #} |
| 128 {% elif container.boolean_type %} | 128 {% elif container.boolean_type %} |
| 129 { | 129 { |
| 130 impl.setBoolean(v8Value->ToBoolean()->Value()); | 130 impl.setBoolean(v8Value->ToBoolean()->Value()); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 {% else %} | 134 {% else %} |
| 135 {# 19. TypeError #} | 135 {# 19. TypeError #} |
| 136 exceptionState.throwTypeError("Not a valid union member."); | 136 exceptionState.throwTypeError("The provided value is not of type '{{containe
r.idl_type}}'"); |
| 137 {% endif %} | 137 {% endif %} |
| 138 } | 138 } |
| 139 | 139 |
| 140 v8::Handle<v8::Value> toV8({{container.cpp_class}}& impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 140 v8::Handle<v8::Value> toV8({{container.cpp_class}}& impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
| 141 { | 141 { |
| 142 switch (impl.m_type) { | 142 switch (impl.m_type) { |
| 143 case {{container.cpp_class}}::SpecificTypeNone: | 143 case {{container.cpp_class}}::SpecificTypeNone: |
| 144 {# FIXME: We might want to return undefined in some cases #} | 144 {# FIXME: We might want to return undefined in some cases #} |
| 145 return v8::Null(isolate); | 145 return v8::Null(isolate); |
| 146 {% for member in container.members %} | 146 {% for member in container.members %} |
| 147 case {{container.cpp_class}}::{{member.specific_type_enum}}: | 147 case {{container.cpp_class}}::{{member.specific_type_enum}}: |
| 148 return {{member.cpp_value_to_v8_value}}; | 148 return {{member.cpp_value_to_v8_value}}; |
| 149 {% endfor %} | 149 {% endfor %} |
| 150 default: | 150 default: |
| 151 ASSERT_NOT_REACHED(); | 151 ASSERT_NOT_REACHED(); |
| 152 } | 152 } |
| 153 return v8::Handle<v8::Value>(); | 153 return v8::Handle<v8::Value>(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue(
const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& except
ionState) | 156 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue(
const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& except
ionState) |
| 157 { | 157 { |
| 158 {{container.cpp_class}} impl; | 158 {{container.cpp_class}} impl; |
| 159 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); | 159 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); |
| 160 return impl; | 160 return impl; |
| 161 } | 161 } |
| 162 | 162 |
| 163 {% endfor %} | 163 {% endfor %} |
| 164 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |