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

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

Issue 689013002: IDL: Generate trace() method in union container types when required (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
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 {% for filename in cpp_includes %} 10 {% for filename in cpp_includes %}
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 void {{container.cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}} value) 29 void {{container.cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}} value)
30 { 30 {
31 ASSERT(isNull()); 31 ASSERT(isNull());
32 m_{{member.cpp_name}} = value; 32 m_{{member.cpp_name}} = value;
33 m_type = {{member.specific_type_enum}}; 33 m_type = {{member.specific_type_enum}};
34 } 34 }
35 35
36 {% endfor %} 36 {% endfor %}
37 {% if container.needs_trace %}
38 void {{container.cpp_class}}::trace(Visitor* visitor)
39 {
40 {% for member in container.members if member.is_traceable %}
41 visitor->trace(m_{{member.cpp_name}});
42 {% endfor %}
43 }
44
45 {% endif %}
37 void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Valu e> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState) 46 void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Valu e> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState)
38 { 47 {
39 {# FIXME: We don't follow the spec on handling null and undefined at this 48 {# FIXME: We don't follow the spec on handling null and undefined at this
40 moment. Should be fixed once we implement all necessary conversion steps 49 moment. Should be fixed once we implement all necessary conversion steps
41 below. #} 50 below. #}
42 if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) 51 if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value))
43 return; 52 return;
44 53
45 {# The numbers in the following comments refer to the steps described in 54 {# The numbers in the following comments refer to the steps described in
46 http://heycam.github.io/webidl/#es-union 55 http://heycam.github.io/webidl/#es-union
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (impl.is{{member.type_name}}()) 132 if (impl.is{{member.type_name}}())
124 return {{member.cpp_value_to_v8_value}}; 133 return {{member.cpp_value_to_v8_value}};
125 134
126 {% endfor %} 135 {% endfor %}
127 ASSERT_NOT_REACHED(); 136 ASSERT_NOT_REACHED();
128 return v8::Handle<v8::Value>(); 137 return v8::Handle<v8::Value>();
129 } 138 }
130 139
131 {% endfor %} 140 {% endfor %}
132 } // namespace blink 141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698