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

Unified Diff: Source/bindings/scripts/v8_methods.py

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/v8_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index 69ba2c1239e59e01df2889ca92611b6780aa739d..3f696d7ea86aab5011f4adc28dbe1a6fe00f163e 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -174,6 +174,7 @@ def generate_argument(interface, method, argument, index):
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index),
+ 'v8_value_to_local_cpp_value_async': v8_value_to_local_cpp_value_async(argument, index),
}
@@ -255,6 +256,24 @@ def v8_value_to_local_cpp_value(argument, index):
v8_value, name, index=index)
+def v8_value_to_local_cpp_value_async(argument, index):
+ extended_attributes = argument.extended_attributes
+ idl_type = argument.idl_type
+ name = argument.name
+ if argument.is_variadic:
+ vector_type = 'WillBeHeapVector' if idl_type.is_will_be_garbage_collected else 'Vector'
Nils Barth (inactive) 2014/04/10 07:48:03 Can use the new v8_types.cpp_ptr_type that haraken
yhirano 2014/04/11 10:19:04 Done.
+ return 'V8TRYCATCH_VOID_PROMISE({vector_type}<{cpp_type}>, {name}, toNativeArguments<{cpp_type}>(info, {index}), info)'.format(
+ cpp_type=idl_type.cpp_type, name=name, index=index, vector_type=vector_type)
+ # [Default=NullString]
+ if (argument.is_optional and idl_type.name == 'String' and
+ extended_attributes.get('Default') == 'NullString'):
+ v8_value = 'argumentOrNull(info, %s)' % index
+ else:
+ v8_value = 'info[%s]' % index
+ return idl_type.v8_value_to_local_cpp_value_async(argument.extended_attributes,
Nils Barth (inactive) 2014/04/10 07:48:03 nit: can write: extended_attributes instead of: ar
yhirano 2014/04/11 10:19:04 Done.
+ v8_value, name, index=index)
+
+
################################################################################
# Auxiliary functions
################################################################################

Powered by Google App Engine
This is Rietveld 408576698