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

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

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 8 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.tmpl' import declare_enum_validation_variable %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable %}
2 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %} 2 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
3 {#############################################################################} 3 {#############################################################################}
4 {% macro assign_and_return_if_hasinstance(member) %} 4 {% macro assign_and_return_if_hasinstance(member) %}
5 {% if member.is_array_buffer_or_view_type %} 5 {% if member.is_array_buffer_or_view_type %}
6 if (v8Value->Is{{member.type_name}}()) { 6 if (v8Value->Is{{member.type_name}}()) {
7 {% else %} 7 {% else %}
8 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { 8 if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) {
9 {% endif %} 9 {% endif %}
10 {% if member.is_array_buffer_view_or_typed_array %}
11 {{member.cpp_local_type}} cppValue = ToNotShared<{{member.cpp_local_type}}>(is olate, v8Value, exceptionState);
12 if (exceptionState.HadException())
13 return;
14 {% else %}
15 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Local< v8::Object>::Cast(v8Value)); 10 {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Local< v8::Object>::Cast(v8Value));
16 {% endif %}
17 impl.set{{member.type_name}}(cppValue); 11 impl.set{{member.type_name}}(cppValue);
18 return; 12 return;
19 } 13 }
20 {% endmacro %} 14 {% endmacro %}
21 {#############################################################################} 15 {#############################################################################}
22 {% filter format_blink_cpp_source_code %} 16 {% filter format_blink_cpp_source_code %}
23 {% include 'copyright_block.txt' %} 17 {% include 'copyright_block.txt' %}
24 #include "{{this_include_header_name}}.h" 18 #include "{{this_include_header_name}}.h"
25 19
26 {% for filename in cpp_includes %} 20 {% for filename in cpp_includes %}
(...skipping 13 matching lines...) Expand all
40 void {{cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}} value) { 34 void {{cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}} value) {
41 DCHECK(isNull()); 35 DCHECK(isNull());
42 {% if member.enum_values %} 36 {% if member.enum_values %}
43 NonThrowableExceptionState exceptionState; 37 NonThrowableExceptionState exceptionState;
44 {{declare_enum_validation_variable(member.enum_values) | indent(2)}} 38 {{declare_enum_validation_variable(member.enum_values) | indent(2)}}
45 if (!IsValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), "{{member. type_name}}", exceptionState)) { 39 if (!IsValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), "{{member. type_name}}", exceptionState)) {
46 NOTREACHED(); 40 NOTREACHED();
47 return; 41 return;
48 } 42 }
49 {% endif %} 43 {% endif %}
50 {% if member.is_array_buffer_view_or_typed_array %}
51 m_{{member.cpp_name}} = {{member.cpp_type}}(value.View());
52 {% else %}
53 m_{{member.cpp_name}} = value; 44 m_{{member.cpp_name}} = value;
54 {% endif %}
55 m_type = {{member.specific_type_enum}}; 45 m_type = {{member.specific_type_enum}};
56 } 46 }
57 47
58 {{cpp_class}} {{cpp_class}}::from{{member.type_name}}({{member.rvalue_cpp_type}} value) { 48 {{cpp_class}} {{cpp_class}}::from{{member.type_name}}({{member.rvalue_cpp_type}} value) {
59 {{cpp_class}} container; 49 {{cpp_class}} container;
60 container.set{{member.type_name}}(value); 50 container.set{{member.type_name}}(value);
61 return container; 51 return container;
62 } 52 }
63 53
64 {% endfor %} 54 {% endfor %}
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 207
218 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) { 208 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate , v8::Local<v8::Value> value, ExceptionState& exceptionState) {
219 {{cpp_class}} impl; 209 {{cpp_class}} impl;
220 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState); 210 {{v8_class}}::toImpl(isolate, value, impl, UnionTypeConversionMode::kNotNullab le, exceptionState);
221 return impl; 211 return impl;
222 } 212 }
223 213
224 } // namespace blink 214 } // namespace blink
225 215
226 {% endfilter %}{# format_blink_cpp_source_code #} 216 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698