Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/union_container.cpp

Issue 1996903002: [Binding] Delete hasInstance() from ArrayBuffer related interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable %}
2 {% include 'copyright_block.txt' %} 2 {% include 'copyright_block.txt' %}
3 #include "{{this_include_header_name}}.h" 3 #include "{{this_include_header_name}}.h"
4 4
5 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} 5 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %}
6 {% macro assign_and_return_if_hasinstance(member) %} 6 {% macro assign_and_return_if_hasinstance(member) %}
7 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { 7 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) {
8 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Loca l<v8::Object>::Cast(v8Value)); 8 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Loca l<v8::Object>::Cast(v8Value));
9 impl.set{{member.type_name}}(cppValue); 9 impl.set{{member.type_name}}(cppValue);
10 return; 10 return;
11 } 11 }
12 {% endmacro %} 12 {% endmacro %}
13 {% macro assign_and_return_if_isinstance(member) %}
bashi 2016/05/20 08:32:46 drive-by: I'd prefer to add |is_instance_expressio
peria 2016/05/20 09:26:16 Done.
14 if (v8Value->Is{{member.type_name}}()) {
15 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Loca l<v8::Object>::Cast(v8Value));
16 impl.set{{member.type_name}}(cppValue);
17 return;
18 }
19 {% endmacro %}
13 {% for filename in cpp_includes %} 20 {% for filename in cpp_includes %}
14 #include "{{filename}}" 21 #include "{{filename}}"
15 {% endfor %} 22 {% endfor %}
16 23
17 namespace blink { 24 namespace blink {
18 25
19 {{cpp_class}}::{{cpp_class}}() 26 {{cpp_class}}::{{cpp_class}}()
20 : m_type(SpecificTypeNone) 27 : m_type(SpecificTypeNone)
21 { 28 {
22 } 29 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull (v8Value)) 80 if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull (v8Value))
74 return; 81 return;
75 82
76 {# 3. Platform objects (interfaces) #} 83 {# 3. Platform objects (interfaces) #}
77 {% for interface in interface_types %} 84 {% for interface in interface_types %}
78 {{assign_and_return_if_hasinstance(interface) | indent}} 85 {{assign_and_return_if_hasinstance(interface) | indent}}
79 86
80 {% endfor %} 87 {% endfor %}
81 {# 8. ArrayBuffer #} 88 {# 8. ArrayBuffer #}
82 {% if array_buffer_type %} 89 {% if array_buffer_type %}
83 {{assign_and_return_if_hasinstance(array_buffer_type) | indent}} 90 {{assign_and_return_if_isinstance(array_buffer_type) | indent}}
84 91
85 {% endif %} 92 {% endif %}
86 {# 9., 10. ArrayBufferView #} 93 {# 9., 10. ArrayBufferView #}
87 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #} 94 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #}
88 {% if array_buffer_view_type %} 95 {% if array_buffer_view_type %}
89 {{assign_and_return_if_hasinstance(array_buffer_view_type) | indent}} 96 {{assign_and_return_if_isinstance(array_buffer_view_type) | indent}}
90 97
91 {% endif %} 98 {% endif %}
92 {% if dictionary_type %} 99 {% if dictionary_type %}
93 {# 12. Dictionaries #} 100 {# 12. Dictionaries #}
94 {# FIXME: This should also check "object but not Date or RegExp". Add checks 101 {# FIXME: This should also check "object but not Date or RegExp". Add checks
95 when we implement conversions for Date and RegExp. #} 102 when we implement conversions for Date and RegExp. #}
96 {# TODO(bashi): The spec doesn't say we should check !IsArray() but otherwis e 103 {# TODO(bashi): The spec doesn't say we should check !IsArray() but otherwis e
97 we can't distinguish a sequence<T> and a dictionary. 104 we can't distinguish a sequence<T> and a dictionary.
98 https://github.com/heycam/webidl/issues/123 #} 105 https://github.com/heycam/webidl/issues/123 #}
99 if (isUndefinedOrNull(v8Value) || (v8Value->IsObject() && !v8Value->IsArray( ))) { 106 if (isUndefinedOrNull(v8Value) || (v8Value->IsObject() && !v8Value->IsArray( ))) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 202 }
196 203
197 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) 204 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState)
198 { 205 {
199 {{cpp_class}} impl; 206 {{cpp_class}} impl;
200 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNulla ble, exceptionState); 207 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNulla ble, exceptionState);
201 return impl; 208 return impl;
202 } 209 }
203 210
204 } // namespace blink 211 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698