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

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

Issue 680193003: IDL: Generate union type containers (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 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
7 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
9 { 9 {
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info); 142 {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info);
143 {% endif %} 143 {% endif %}
144 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 144 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
145 } 145 }
146 146
147 {% endif %} 147 {% endif %}
148 {% endblock %} 148 {% endblock %}
149 149
150 150
151 {##############################################################################} 151 {##############################################################################}
152 {% from 'methods.cpp' import union_type_method_call_and_set_return_value %}
153 {% block named_property_getter %} 152 {% block named_property_getter %}
154 {% if named_property_getter and not named_property_getter.is_custom %} 153 {% if named_property_getter and not named_property_getter.is_custom %}
155 {% set getter = named_property_getter %} 154 {% set getter = named_property_getter %}
156 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) 155 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
157 { 156 {
158 {% if not is_override_builtins %} 157 {% if not is_override_builtins %}
159 if (info.Holder()->HasRealNamedProperty(name)) 158 if (info.Holder()->HasRealNamedProperty(name))
160 return; 159 return;
161 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 160 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
162 return; 161 return;
163 162
164 {% endif %} 163 {% endif %}
165 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 164 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
166 AtomicString propertyName = toCoreAtomicString(name); 165 AtomicString propertyName = toCoreAtomicString(name);
167 {% if getter.is_raises_exception %} 166 {% if getter.is_raises_exception %}
168 v8::String::Utf8Value namedProperty(name); 167 v8::String::Utf8Value namedProperty(name);
169 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 168 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
170 {% endif %} 169 {% endif %}
171 {% if getter.union_arguments %} 170 {% if getter.use_output_parameter_for_result %}
172 {{union_type_method_call_and_set_return_value(getter) | indent}} 171 {{getter.cpp_type}} result;
172 {{getter.cpp_value}};
173 {% else %} 173 {% else %}
174 {{getter.cpp_type}} result = {{getter.cpp_value}}; 174 {{getter.cpp_type}} result = {{getter.cpp_value}};
175 {% endif %}
175 {% if getter.is_raises_exception %} 176 {% if getter.is_raises_exception %}
176 if (exceptionState.throwIfNeeded()) 177 if (exceptionState.throwIfNeeded())
177 return; 178 return;
178 {% endif %} 179 {% endif %}
179 if ({{getter.is_null_expression}}) 180 if ({{getter.is_null_expression}})
180 return; 181 return;
181 {{getter.v8_set_return_value}}; 182 {{getter.v8_set_return_value}};
182 {% endif %}
183 } 183 }
184 184
185 {% endif %} 185 {% endif %}
186 {% endblock %} 186 {% endblock %}
187 187
188 188
189 {##############################################################################} 189 {##############################################################################}
190 {% block named_property_getter_callback %} 190 {% block named_property_getter_callback %}
191 {% if named_property_getter %} 191 {% if named_property_getter %}
192 {% set getter = named_property_getter %} 192 {% set getter = named_property_getter %}
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1021 }
1022 1022
1023 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 1023 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
1024 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 1024 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
1025 { 1025 {
1026 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 1026 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
1027 } 1027 }
1028 {% endfor %} 1028 {% endfor %}
1029 {% endif %} 1029 {% endif %}
1030 {% endblock %} 1030 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698