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 install_hasinstance_check(member) %} | |
haraken
2014/11/04 02:20:14
"install_" sounds a bit strange. hasinstance_check
bashi
2014/11/04 02:30:32
Done.
Yuki
2014/11/04 06:35:14
We already have to_impl_with_type_check block in i
Jens Widell
2014/11/04 07:22:56
Oh, naming of things is always fun! :-)
How about
bashi
2014/11/04 08:35:05
"assign_and_return_if_hasinstnace" sounds good:) D
| |
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)); | |
13 impl.set{{member.type_name}}(cppValue); | |
14 return; | |
15 } | |
16 {% endmacro %} | |
10 {% for filename in cpp_includes %} | 17 {% for filename in cpp_includes %} |
11 #include "{{filename}}" | 18 #include "{{filename}}" |
12 {% endfor %} | 19 {% endfor %} |
13 | 20 |
14 namespace blink { | 21 namespace blink { |
15 | 22 |
16 {% for container in containers %} | 23 {% for container in containers %} |
17 {{container.cpp_class}}::{{container.cpp_class}}() | 24 {{container.cpp_class}}::{{container.cpp_class}}() |
18 : m_type(SpecificTypeNone) | 25 : m_type(SpecificTypeNone) |
19 { | 26 { |
(...skipping 29 matching lines...) Expand all Loading... | |
49 moment. Should be fixed once we implement all necessary conversion steps | 56 moment. Should be fixed once we implement all necessary conversion steps |
50 below. #} | 57 below. #} |
51 if (v8Value.IsEmpty()) | 58 if (v8Value.IsEmpty()) |
52 return; | 59 return; |
53 | 60 |
54 {# The numbers in the following comments refer to the steps described in | 61 {# The numbers in the following comments refer to the steps described in |
55 http://heycam.github.io/webidl/#es-union | 62 http://heycam.github.io/webidl/#es-union |
56 FIXME: Implement all necessary steps #} | 63 FIXME: Implement all necessary steps #} |
57 {# 3. Platform objects (interfaces) #} | 64 {# 3. Platform objects (interfaces) #} |
58 {% for interface in container.interface_types %} | 65 {% for interface in container.interface_types %} |
59 if (V8{{interface.type_name}}::hasInstance(v8Value, isolate)) { | 66 {{install_hasinstance_check(interface) | indent}} |
60 {{interface.cpp_local_type}} cppValue = V8{{interface.type_name}}::toImp l(v8::Handle<v8::Object>::Cast(v8Value)); | |
61 impl.set{{interface.type_name}}(cppValue); | |
62 return; | |
63 } | |
64 | 67 |
65 {% endfor %} | 68 {% endfor %} |
69 {# 8. ArrayBuffer #} | |
70 {% if container.array_buffer_type %} | |
71 {{install_hasinstance_check(container.array_buffer_type) | indent}} | |
72 | |
73 {% endif %} | |
74 {# 9., 10. ArrayBufferView #} | |
75 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #} | |
76 {% if container.array_buffer_view_type %} | |
77 {{install_hasinstance_check(container.array_buffer_view_type) | indent}} | |
78 | |
79 {% endif %} | |
66 {% if container.dictionary_type %} | 80 {% if container.dictionary_type %} |
67 {# 12. Dictionaries #} | 81 {# 12. Dictionaries #} |
68 {# FIXME: This should also check "object but not Date or RegExp". Add checks | 82 {# FIXME: This should also check "object but not Date or RegExp". Add checks |
69 when we implement conversions for Date and RegExp. #} | 83 when we implement conversions for Date and RegExp. #} |
70 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { | 84 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
71 {{container.dictionary_type.cpp_local_type}} cppValue = V8{{container.di ctionary_type.type_name}}::toImpl(isolate, v8Value, exceptionState); | 85 {{container.dictionary_type.cpp_local_type}} cppValue = V8{{container.di ctionary_type.type_name}}::toImpl(isolate, v8Value, exceptionState); |
72 if (!exceptionState.hadException()) | 86 if (!exceptionState.hadException()) |
73 impl.set{{container.dictionary_type.type_name}}(cppValue); | 87 impl.set{{container.dictionary_type.type_name}}(cppValue); |
74 return; | 88 return; |
75 } | 89 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 if (impl.is{{member.type_name}}()) | 146 if (impl.is{{member.type_name}}()) |
133 return {{member.cpp_value_to_v8_value}}; | 147 return {{member.cpp_value_to_v8_value}}; |
134 | 148 |
135 {% endfor %} | 149 {% endfor %} |
136 ASSERT_NOT_REACHED(); | 150 ASSERT_NOT_REACHED(); |
137 return v8::Handle<v8::Value>(); | 151 return v8::Handle<v8::Value>(); |
138 } | 152 } |
139 | 153 |
140 {% endfor %} | 154 {% endfor %} |
141 } // namespace blink | 155 } // namespace blink |
OLD | NEW |