Index: Source/bindings/scripts/v8_methods.py |
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py |
index 32888200307bf31616616ac90d3e5f7c659953c0..01a4369b5f25184f4c410ad2a1292b1fdfc8ddfc 100644 |
--- a/Source/bindings/scripts/v8_methods.py |
+++ b/Source/bindings/scripts/v8_methods.py |
@@ -175,8 +175,9 @@ def method_context(interface, method, is_visible=True): |
'only_exposed_to_private_script': is_only_exposed_to_private_script, |
'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(method), # [PerContextEnabled] |
'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
- extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->isolate()', used_in_private_script=True), |
+ extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->isolate()', bailout_return_value='false'), |
'property_attributes': property_attributes(interface, method), |
+ 'returns_promise': method.returns_promise, |
'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(method), # [RuntimeEnabled] |
'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), |
'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature', |
@@ -242,7 +243,7 @@ def argument_context(interface, method, argument, index): |
'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes, |
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), |
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), |
- 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, return_promise=method.returns_promise, restricted_float=restricted_float), |
+ 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(method, argument, index, restricted_float=restricted_float), |
'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type), |
} |
@@ -347,37 +348,33 @@ def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) |
return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_wrappable=script_wrappable, release=release, for_main_world=for_main_world) |
-def v8_value_to_local_cpp_variadic_value(argument, index, return_promise): |
+def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise): |
assert argument.is_variadic |
idl_type = argument.idl_type |
- suffix = '' |
+ if method.returns_promise: |
+ helper = 'convertAndCheck' |
+ else: |
+ helper = 'convertAndThrow' |
- macro = 'TONATIVE_VOID_EXCEPTIONSTATE' |
- macro_args = [ |
- argument.name, |
- 'toImplArguments<%s>(info, %s, exceptionState)' % (idl_type.cpp_type, index), |
- 'exceptionState', |
+ macro = 'TONATIVE_CONVERT' |
+ arguments = [ |
+ '%s(%s = toImplArguments<%s>(info, %s, exceptionState), exceptionState)' % (helper, argument.name, idl_type.cpp_type, index), |
+ 'return' |
] |
- if return_promise: |
- suffix += '_PROMISE' |
- macro_args.extend(['info', 'ScriptState::current(info.GetIsolate())']) |
- |
- suffix += '_INTERNAL' |
- |
- return '%s%s(%s)' % (macro, suffix, ', '.join(macro_args)) |
+ return '%s(%s)' % (macro, ', '.join(arguments)) |
bashi
2015/02/23 23:44:06
Just use 'TONATIVE_CONVERT' and remove |macro|?
|
-def v8_value_to_local_cpp_value(argument, index, return_promise=False, restricted_float=False): |
+def v8_value_to_local_cpp_value(method, argument, index, return_promise=False, restricted_float=False): |
extended_attributes = argument.extended_attributes |
idl_type = argument.idl_type |
name = argument.name |
if argument.is_variadic: |
- return v8_value_to_local_cpp_variadic_value(argument, index, return_promise) |
+ return v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise) |
return idl_type.v8_value_to_local_cpp_value(extended_attributes, 'info[%s]' % index, |
name, index=index, declare_variable=False, |
- return_promise=return_promise, |
+ use_exception_state=method.returns_promise, |
restricted_float=restricted_float) |