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

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

Issue 390223004: initialize result variables in v8 bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(script State, info, {{method.number_of_arguments}})); 240 RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(script State, info, {{method.number_of_arguments}}));
241 {% endif %} 241 {% endif %}
242 {% if method.is_call_with_document %} 242 {% if method.is_call_with_document %}
243 {# [ConstructorCallWith=Document] #} 243 {# [ConstructorCallWith=Document] #}
244 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); 244 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
245 {% endif %} 245 {% endif %}
246 {# Call #} 246 {# Call #}
247 {% if method.idl_type == 'void' %} 247 {% if method.idl_type == 'void' %}
248 {{cpp_value}}; 248 {{cpp_value}};
249 {% elif method.is_implemented_in_private_script %} 249 {% elif method.is_implemented_in_private_script %}
250 {{method.cpp_type}} result; 250 {{method.cpp_type}} result{% if method.cpp_type == 'int' %} = 0{% endif %};
haraken 2014/07/15 15:13:25 method.cpp_type == 'int' is a bit too hacky. Can
251 if (!{{method.cpp_value}}) 251 if (!{{method.cpp_value}})
252 return; 252 return;
253 {% elif method.is_constructor %} 253 {% elif method.is_constructor %}
254 {{method.cpp_type}} impl = {{cpp_value}}; 254 {{method.cpp_type}} impl = {{cpp_value}};
255 {% elif method.use_local_result and not method.union_arguments %} 255 {% elif method.use_local_result and not method.union_arguments %}
256 {{method.cpp_type}} result = {{cpp_value}}; 256 {{method.cpp_type}} result = {{cpp_value}};
257 {% endif %} 257 {% endif %}
258 {# Post-call #} 258 {# Post-call #}
259 {% if method.is_raises_exception %} 259 {% if method.is_raises_exception %}
260 if (exceptionState.hadException()) { 260 if (exceptionState.hadException()) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); 597 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
598 {% else %} 598 {% else %}
599 {% set constructor_class = v8_class + ('Constructor' 599 {% set constructor_class = v8_class + ('Constructor'
600 if constructor.is_named_constructor else 600 if constructor.is_named_constructor else
601 '') %} 601 '') %}
602 v8::Handle<v8::Object> wrapper = info.Holder(); 602 v8::Handle<v8::Object> wrapper = info.Holder();
603 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); 603 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}});
604 {% endif %} 604 {% endif %}
605 v8SetReturnValue(info, wrapper); 605 v8SetReturnValue(info, wrapper);
606 {% endmacro %} 606 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698