| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 | 124 |
| 125 {# 18. Boolean (fallback) #} | 125 {# 18. Boolean (fallback) #} |
| 126 {% elif container.boolean_type %} | 126 {% elif container.boolean_type %} |
| 127 { | 127 { |
| 128 impl.setBoolean(v8Value->ToBoolean()->Value()); | 128 impl.setBoolean(v8Value->ToBoolean()->Value()); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 | 131 |
| 132 {% endif %} | 132 {% else %} |
| 133 {# 19. TypeError #} | 133 {# 19. TypeError #} |
| 134 exceptionState.throwTypeError("Not a valid union member."); | 134 exceptionState.throwTypeError("Not a valid union member."); |
| 135 {% endif %} |
| 135 } | 136 } |
| 136 | 137 |
| 137 v8::Handle<v8::Value> toV8({{container.cpp_class}}& impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 138 v8::Handle<v8::Value> toV8({{container.cpp_class}}& impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
| 138 { | 139 { |
| 139 switch (impl.m_type) { | 140 switch (impl.m_type) { |
| 140 case {{container.cpp_class}}::SpecificTypeNone: | 141 case {{container.cpp_class}}::SpecificTypeNone: |
| 141 {# FIXME: We might want to return undefined in some cases #} | 142 {# FIXME: We might want to return undefined in some cases #} |
| 142 return v8::Null(isolate); | 143 return v8::Null(isolate); |
| 143 {% for member in container.members %} | 144 {% for member in container.members %} |
| 144 case {{container.cpp_class}}::{{member.specific_type_enum}}: | 145 case {{container.cpp_class}}::{{member.specific_type_enum}}: |
| 145 return {{member.cpp_value_to_v8_value}}; | 146 return {{member.cpp_value_to_v8_value}}; |
| 146 {% endfor %} | 147 {% endfor %} |
| 147 default: | 148 default: |
| 148 ASSERT_NOT_REACHED(); | 149 ASSERT_NOT_REACHED(); |
| 149 } | 150 } |
| 150 return v8::Handle<v8::Value>(); | 151 return v8::Handle<v8::Value>(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 {% endfor %} | 154 {% endfor %} |
| 154 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |