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

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: fixups for jens 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{{method.cpp_type_initializer}};
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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); 593 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ());
594 {% else %} 594 {% else %}
595 {% set constructor_class = v8_class + ('Constructor' 595 {% set constructor_class = v8_class + ('Constructor'
596 if constructor.is_named_constructor else 596 if constructor.is_named_constructor else
597 '') %} 597 '') %}
598 v8::Handle<v8::Object> wrapper = info.Holder(); 598 v8::Handle<v8::Object> wrapper = info.Holder();
599 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); 599 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}});
600 {% endif %} 600 {% endif %}
601 v8SetReturnValue(info, wrapper); 601 v8SetReturnValue(info, wrapper);
602 {% endmacro %} 602 {% 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