Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 {# [ConstructorCallWith=Document] #} | 226 {# [ConstructorCallWith=Document] #} |
| 227 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); | 227 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); |
| 228 {% endif %} | 228 {% endif %} |
| 229 {# Call #} | 229 {# Call #} |
| 230 {% if method.idl_type == 'void' %} | 230 {% if method.idl_type == 'void' %} |
| 231 {{cpp_value}}; | 231 {{cpp_value}}; |
| 232 {% elif method.is_implemented_in_private_script %} | 232 {% elif method.is_implemented_in_private_script %} |
| 233 {{method.cpp_type}} result{{method.cpp_type_initializer}}; | 233 {{method.cpp_type}} result{{method.cpp_type_initializer}}; |
| 234 if (!{{method.cpp_value}}) | 234 if (!{{method.cpp_value}}) |
| 235 return; | 235 return; |
| 236 {% elif method.use_argument_for_return_value %} | |
| 237 {{method.cpp_type}} cppValue; | |
|
haraken
2014/10/15 14:38:29
I'd rename |cppValue| to |result| for consistency
bashi
2014/10/17 00:50:05
Done.
| |
| 238 {{cpp_value}}; | |
| 236 {% elif method.is_constructor %} | 239 {% elif method.is_constructor %} |
| 237 {{method.cpp_type}} impl = {{cpp_value}}; | 240 {{method.cpp_type}} impl = {{cpp_value}}; |
| 238 {% elif method.use_local_result and not method.union_arguments %} | 241 {% elif method.use_local_result and not method.union_arguments %} |
| 239 {{method.cpp_type}} result = {{cpp_value}}; | 242 {{method.cpp_type}} result = {{cpp_value}}; |
|
haraken
2014/10/15 14:38:29
We were trying to _always_ use local result to sim
Jens Widell
2014/10/15 15:39:17
https://codereview.chromium.org/386613002/
The st
bashi
2014/10/17 00:50:05
I had forgotten too. Maybe we can revisit this whe
haraken
2014/10/17 00:57:12
The reason I asked this is that forcing a local re
| |
| 240 {% endif %} | 243 {% endif %} |
| 241 {# Post-call #} | 244 {# Post-call #} |
| 242 {% if method.is_raises_exception %} | 245 {% if method.is_raises_exception %} |
| 243 if (exceptionState.hadException()) { | 246 if (exceptionState.hadException()) { |
| 244 {{throw_from_exception_state(method)}}; | 247 {{throw_from_exception_state(method)}}; |
| 245 return; | 248 return; |
| 246 } | 249 } |
| 247 {% endif %} | 250 {% endif %} |
| 248 {# Set return value #} | 251 {# Set return value #} |
| 249 {% if method.is_constructor %} | 252 {% if method.is_constructor %} |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 616 if method.is_per_world_bindings else '0' %} | 619 if method.is_per_world_bindings else '0' %} |
| 617 {% set property_attribute = | 620 {% set property_attribute = |
| 618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) | 621 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) |
| 619 if method.property_attributes else 'v8::None' %} | 622 if method.property_attributes else 'v8::None' %} |
| 620 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} | 623 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} |
| 621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { | 624 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { |
| 622 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, | 625 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, |
| 623 }; | 626 }; |
| 624 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 627 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
| 625 {%- endmacro %} | 628 {%- endmacro %} |
| OLD | NEW |