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

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

Issue 313993002: Bindings: Add ScalarValueString support (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index bb2fac1f410d8fcbe0199c712b84efbc2dad3ed0..7f04b3d4cf8523315cf7d580a3b4a171eda8b1ec 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'):
+ if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
if not used_as_argument:
return 'String'
return 'V8StringResource<%s>' % string_mode()
@@ -365,6 +365,7 @@ V8_VALUE_TO_CPP_VALUE = {
'Date': 'toCoreDate({v8_value})',
'DOMString': '{v8_value}',
'ByteString': 'toByteString({arguments})',
+ 'ScalarValueString': 'toScalarValueString({arguments})',
'boolean': '{v8_value}->BooleanValue()',
'float': 'static_cast<float>({v8_value}->NumberValue())',
'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())',
@@ -405,7 +406,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 idl_type.name == 'ByteString': # NormalConversion
+ elif idl_type.is_integer_type or idl_type.name in ('ByteString', 'ScalarValueString'): # NormalConversion
Nils Barth (inactive) 2014/06/11 03:54:26 ditto
jsbell 2014/06/12 17:45:55 Done.
arguments = ', '.join([v8_value, 'exceptionState'])
else:
arguments = v8_value
@@ -453,7 +454,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 == 'ByteString':
+ elif idl_type.is_integer_type or idl_type.name in ('ByteString', 'ScalarValueString'):
Nils Barth (inactive) 2014/06/11 03:54:26 ditto
jsbell 2014/06/12 17:45:55 Done.
macro = 'TONATIVE_VOID_EXCEPTIONSTATE'
args.append('exceptionState')
else:
@@ -565,6 +566,7 @@ V8_SET_RETURN_VALUE = {
'unsigned': 'v8SetReturnValueUnsigned(info, {cpp_value})',
'DOMString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
'ByteString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
+ 'ScalarValueString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
# [TreatNullReturnValueAs]
'StringOrNull': 'v8SetReturnValueStringOrNull(info, {cpp_value}, info.GetIsolate())',
'StringOrUndefined': 'v8SetReturnValueStringOrUndefined(info, {cpp_value}, info.GetIsolate())',
@@ -645,6 +647,7 @@ CPP_VALUE_TO_V8_VALUE = {
'Date': 'v8DateOrNaN({cpp_value}, {isolate})',
'DOMString': 'v8String({isolate}, {cpp_value})',
'ByteString': 'v8String({isolate}, {cpp_value})',
+ 'ScalarValueString': 'v8String({isolate}, {cpp_value})',
'boolean': 'v8Boolean({cpp_value}, {isolate})',
'int': 'v8::Integer::New({isolate}, {cpp_value})',
'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})',

Powered by Google App Engine
This is Rietveld 408576698