| 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) %} |
| 11 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { | 11 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { |
| 12 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Hand
le<v8::Object>::Cast(v8Value)); | 12 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Loca
l<v8::Object>::Cast(v8Value)); |
| 13 impl.set{{member.type_name}}(cppValue); | 13 impl.set{{member.type_name}}(cppValue); |
| 14 return; | 14 return; |
| 15 } | 15 } |
| 16 {% endmacro %} | 16 {% endmacro %} |
| 17 {% for filename in cpp_includes %} | 17 {% for filename in cpp_includes %} |
| 18 #include "{{filename}}" | 18 #include "{{filename}}" |
| 19 {% endfor %} | 19 {% endfor %} |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 43 {% endfor %} | 43 {% endfor %} |
| 44 {% if container.needs_trace %} | 44 {% if container.needs_trace %} |
| 45 void {{container.cpp_class}}::trace(Visitor* visitor) | 45 void {{container.cpp_class}}::trace(Visitor* visitor) |
| 46 { | 46 { |
| 47 {% for member in container.members if member.is_traceable %} | 47 {% for member in container.members if member.is_traceable %} |
| 48 visitor->trace(m_{{member.cpp_name}}); | 48 visitor->trace(m_{{member.cpp_name}}); |
| 49 {% endfor %} | 49 {% endfor %} |
| 50 } | 50 } |
| 51 | 51 |
| 52 {% endif %} | 52 {% endif %} |
| 53 void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Valu
e> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState) | 53 void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value
> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 if (v8Value.IsEmpty()) | 55 if (v8Value.IsEmpty()) |
| 56 return; | 56 return; |
| 57 | 57 |
| 58 {# The numbers in the following comments refer to the steps described in | 58 {# The numbers in the following comments refer to the steps described in |
| 59 http://heycam.github.io/webidl/#es-union | 59 http://heycam.github.io/webidl/#es-union |
| 60 NOTE: Step 1 (null or undefined) is handled in *OrNull::toImpl() | 60 NOTE: Step 1 (null or undefined) is handled in *OrNull::toImpl() |
| 61 FIXME: Implement all necessary steps #} | 61 FIXME: Implement all necessary steps #} |
| 62 {# 3. Platform objects (interfaces) #} | 62 {# 3. Platform objects (interfaces) #} |
| 63 {% for interface in container.interface_types %} | 63 {% for interface in container.interface_types %} |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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("The provided value is not of type '{{containe
r.type_string}}'"); | 136 exceptionState.throwTypeError("The provided value is not of type '{{containe
r.type_string}}'"); |
| 137 {% endif %} | 137 {% endif %} |
| 138 } | 138 } |
| 139 | 139 |
| 140 v8::Handle<v8::Value> toV8(const {{container.cpp_class}}& impl, v8::Handle<v8::O
bject> creationContext, v8::Isolate* isolate) | 140 v8::Local<v8::Value> toV8(const {{container.cpp_class}}& impl, v8::Local<v8::Obj
ect> 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::Local<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::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& excepti
onState) |
| 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 |