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

Side by Side Diff: Source/bindings/templates/union.cpp

Issue 713403004: IDL: Generic Dictionary support in union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/bindings/scripts/v8_union.py ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #} 73 {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #}
74 {% if container.array_buffer_view_type %} 74 {% if container.array_buffer_view_type %}
75 {{assign_and_return_if_hasinstance(container.array_buffer_view_type) | inden t}} 75 {{assign_and_return_if_hasinstance(container.array_buffer_view_type) | inden t}}
76 76
77 {% endif %} 77 {% endif %}
78 {% if container.dictionary_type %} 78 {% if container.dictionary_type %}
79 {# 12. Dictionaries #} 79 {# 12. Dictionaries #}
80 {# FIXME: This should also check "object but not Date or RegExp". Add checks 80 {# FIXME: This should also check "object but not Date or RegExp". Add checks
81 when we implement conversions for Date and RegExp. #} 81 when we implement conversions for Date and RegExp. #}
82 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { 82 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) {
83 {{container.dictionary_type.cpp_local_type}} cppValue = V8{{container.di ctionary_type.type_name}}::toImpl(isolate, v8Value, exceptionState); 83 {% if container.dictionary_type.type_name != 'Dictionary' %}
bashi 2014/11/12 05:13:07 This was wrong. Union type containers' toImpl() do
84 if (!exceptionState.hadException()) 84 {{container.dictionary_type.cpp_local_type}} cppValue;
85 impl.set{{container.dictionary_type.type_name}}(cppValue); 85 {% endif %}
86 {{container.dictionary_type.v8_value_to_local_cpp_value}};
87 impl.set{{container.dictionary_type.type_name}}(cppValue);
86 return; 88 return;
87 } 89 }
88 90
89 {% endif %} 91 {% endif %}
90 {# FIXME: In some cases, we can omit boolean and numeric type checks because 92 {# FIXME: In some cases, we can omit boolean and numeric type checks because
91 we have fallback conversions. (step 17 and 18) #} 93 we have fallback conversions. (step 17 and 18) #}
92 {% if container.boolean_type %} 94 {% if container.boolean_type %}
93 {# 14. Boolean #} 95 {# 14. Boolean #}
94 if (v8Value->IsBoolean()) { 96 if (v8Value->IsBoolean()) {
95 impl.setBoolean(v8Value->ToBoolean()->Value()); 97 impl.setBoolean(v8Value->ToBoolean()->Value());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 {{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::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& except ionState)
155 { 157 {
156 {{container.cpp_class}} impl; 158 {{container.cpp_class}} impl;
157 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); 159 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState);
158 return impl; 160 return impl;
159 } 161 }
160 162
161 {% endfor %} 163 {% endfor %}
162 } // namespace blink 164 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_union.py ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698