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

Unified Diff: Source/bindings/scripts/unstable/v8_types.py

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update new IDL compiler to match Created 6 years, 12 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/unstable/v8_types.py
diff --git a/Source/bindings/scripts/unstable/v8_types.py b/Source/bindings/scripts/unstable/v8_types.py
index 131b804ce9e7c792218028e3314687d19c046e8d..c3035360e66715c4a79682c6b529807c57bc0e36 100644
--- a/Source/bindings/scripts/unstable/v8_types.py
+++ b/Source/bindings/scripts/unstable/v8_types.py
@@ -142,6 +142,9 @@ def is_union_type(idl_type):
return isinstance(idl_type, idl_definitions.IdlUnionType)
+def is_integer_type(idl_type):
+ return any(idl_type in s for s in [CPP_INT_TYPES, CPP_UNSIGNED_TYPES, CPP_LONG_LONG_TYPES])
Nils Barth (inactive) 2014/01/06 02:58:09 Simpler: return idl_type in CPP_INT_TYPES | CPP_UN
sof 2014/01/06 21:01:25 Adopted wholesale; the transformation added here i
+
################################################################################
# V8-specific type handling
################################################################################
@@ -237,6 +240,10 @@ CPP_SPECIAL_CONVERSION_RULES = {
'ScriptValue': 'ScriptValue',
'boolean': 'bool',
}
+CPP_LONG_LONG_TYPES = set([
Nils Barth (inactive) 2014/01/06 02:58:09 Could you put this set up *above* CPP_SPECIAL_CONV
sof 2014/01/06 21:01:25 Removed.
+ 'long long',
+ 'unsigned long long',
+])
def cpp_type(idl_type, extended_attributes=None, used_as_argument=False):
"""Returns C++ type corresponding to IDL type."""
@@ -377,8 +384,10 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index):
add_includes_for_type(idl_type)
if 'EnforceRange' in extended_attributes:
- arguments = ', '.join([v8_value, 'EnforceRange', 'ok'])
- else: # NormalConversion
+ arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState'])
+ elif is_integer_type(idl_type): # NormalConversion
Nils Barth (inactive) 2014/01/06 02:58:09 Comment '# NormalConversion' should go on the defa
sof 2014/01/06 21:01:25 Isn't this the correct placement for it? i.e., thi
Nils Barth (inactive) 2014/01/07 02:11:35 OIC, you're right - sorry, thanks! (NormalConversi
+ arguments = ', '.join([v8_value, 'exceptionState'])
+ else:
arguments = v8_value
if idl_type in V8_VALUE_TO_CPP_VALUE:
@@ -421,8 +430,8 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
idl_type = preprocess_idl_type(idl_type)
if idl_type == 'DOMString':
format_string = 'V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID({cpp_type}, {variable_name}, {cpp_value})'
- elif 'EnforceRange' in extended_attributes:
- format_string = 'V8TRYCATCH_WITH_TYPECHECK_VOID({cpp_type}, {variable_name}, {cpp_value}, info.GetIsolate())'
+ elif is_integer_type(idl_type):
+ format_string = 'V8TRYCATCH_EXCEPTION_VOID({cpp_type}, {variable_name}, {cpp_value}, exceptionState)'
else:
format_string = 'V8TRYCATCH_VOID({cpp_type}, {variable_name}, {cpp_value})'

Powered by Google App Engine
This is Rietveld 408576698