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

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

Issue 338893004: Extend ScalarValueString handling to include constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaks Created 6 years, 6 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
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/TestInterfaceConstructor4.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index 5f735af235cb5f6e211589cff8830bd9a92df915..f8c83faf67d984bacdbaaf9d35f5155f97fc4052 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -167,7 +167,7 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as
if base_idl_type in NON_WRAPPER_TYPES:
return 'RefPtr<%s>' % base_idl_type
- if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+ if idl_type.is_string_type:
if not used_as_argument:
return 'String'
return 'V8StringResource<%s>' % string_mode()
@@ -417,8 +417,7 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index):
if 'EnforceRange' in extended_attributes:
arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState'])
- elif (idl_type.is_integer_type or # NormalConversion
- idl_type.name in ('ByteString', 'ScalarValueString')):
+ elif idl_type.may_raise_exception_on_conversion:
arguments = ', '.join([v8_value, 'exceptionState'])
else:
arguments = v8_value
@@ -466,8 +465,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
args = [variable_name, cpp_value]
if idl_type.base_type == 'DOMString' and not idl_type.array_or_sequence_type:
macro = 'TOSTRING_VOID'
- elif (idl_type.is_integer_type or
- idl_type.name in ('ByteString', 'ScalarValueString')):
+ elif idl_type.may_raise_exception_on_conversion:
macro = 'TONATIVE_VOID_EXCEPTIONSTATE'
args.append('exceptionState')
else:
@@ -550,7 +548,7 @@ def v8_conversion_type(idl_type, extended_attributes):
return 'int'
if base_idl_type in CPP_UNSIGNED_TYPES:
return 'unsigned'
- if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+ if idl_type.is_string_type:
if 'TreatReturnedNullStringAs' not in extended_attributes:
return base_idl_type
treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs']
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/TestInterfaceConstructor4.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698