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

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

Issue 937773002: IDL: Support default values for dictionary members of union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 // 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 29 matching lines...) Expand all
40 String string = value; 40 String string = value;
41 if (!({{member.enum_validation_expression}})) { 41 if (!({{member.enum_validation_expression}})) {
42 ASSERT_NOT_REACHED(); 42 ASSERT_NOT_REACHED();
43 return; 43 return;
44 } 44 }
45 {% endif %} 45 {% endif %}
46 m_{{member.cpp_name}} = value; 46 m_{{member.cpp_name}} = value;
47 m_type = {{member.specific_type_enum}}; 47 m_type = {{member.specific_type_enum}};
48 } 48 }
49 49
50 {{container.cpp_class}} {{container.cpp_class}}::from{{member.type_name}}({{memb er.rvalue_cpp_type}} value)
51 {
52 {{container.cpp_class}} container;
53 container.set{{member.type_name}}(value);
54 return container;
55 }
56
50 {% endfor %} 57 {% endfor %}
51 {% if container.needs_trace %} 58 {% if container.needs_trace %}
52 void {{container.cpp_class}}::trace(Visitor* visitor) 59 void {{container.cpp_class}}::trace(Visitor* visitor)
53 { 60 {
54 {% for member in container.members if member.is_traceable %} 61 {% for member in container.members if member.is_traceable %}
55 visitor->trace(m_{{member.cpp_name}}); 62 visitor->trace(m_{{member.cpp_name}});
56 {% endfor %} 63 {% endfor %}
57 } 64 }
58 65
59 {% endif %} 66 {% endif %}
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 188
182 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue( const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& excepti onState) 189 {{container.cpp_class}} NativeValueTraits<{{container.cpp_class}}>::nativeValue( const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& excepti onState)
183 { 190 {
184 {{container.cpp_class}} impl; 191 {{container.cpp_class}} impl;
185 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState); 192 V8{{container.cpp_class}}::toImpl(isolate, value, impl, exceptionState);
186 return impl; 193 return impl;
187 } 194 }
188 195
189 {% endfor %} 196 {% endfor %}
190 } // namespace blink 197 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698