Chromium Code Reviews| Index: Source/bindings/scripts/v8_types.py |
| diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py |
| index a2b0d1f0c1dadfa59b509e911a914e0dd718b7c9..37e47cca2d12b9823e395d868a267069385f492c 100644 |
| --- a/Source/bindings/scripts/v8_types.py |
| +++ b/Source/bindings/scripts/v8_types.py |
| @@ -171,6 +171,8 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as |
| if not used_as_argument: |
| return 'String' |
| return 'V8StringResource<%s>' % string_mode() |
| + if base_idl_type == 'ByteString': |
|
Nils Barth (inactive)
2014/06/02 03:20:16
Should this be merged with the DOMString above?
(P
jsbell
2014/06/03 23:22:36
This failed due to the generated (and de-macro-ifi
|
| + return 'String' |
| if idl_type.is_typed_array_type and used_as_argument: |
| return base_idl_type + '*' |
| @@ -364,6 +366,7 @@ V8_VALUE_TO_CPP_VALUE = { |
| # Basic |
| 'Date': 'toCoreDate({v8_value})', |
| 'DOMString': '{v8_value}', |
| + 'ByteString': 'toByteString({arguments})', |
| 'boolean': '{v8_value}->BooleanValue()', |
| 'float': 'static_cast<float>({v8_value}->NumberValue())', |
| 'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())', |
| @@ -404,7 +407,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: # NormalConversion |
| + elif idl_type.is_integer_type or idl_type.base_type == 'ByteString': # NormalConversion |
| arguments = ', '.join([v8_value, 'exceptionState']) |
| else: |
| arguments = v8_value |
| @@ -452,7 +455,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: |
| + elif idl_type.is_integer_type or idl_type.base_type == 'ByteString': |
| macro = 'TONATIVE_VOID_EXCEPTIONSTATE' |
| args.append('exceptionState') |
| else: |
| @@ -572,6 +575,7 @@ V8_SET_RETURN_VALUE = { |
| 'int': 'v8SetReturnValueInt(info, {cpp_value})', |
| 'unsigned': 'v8SetReturnValueUnsigned(info, {cpp_value})', |
| 'DOMString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())', |
| + 'ByteString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())', |
| # [TreatNullReturnValueAs] |
| 'StringOrNull': 'v8SetReturnValueStringOrNull(info, {cpp_value}, info.GetIsolate())', |
| 'StringOrUndefined': 'v8SetReturnValueStringOrUndefined(info, {cpp_value}, info.GetIsolate())', |
| @@ -651,6 +655,7 @@ CPP_VALUE_TO_V8_VALUE = { |
| # Built-in types |
| 'Date': 'v8DateOrNaN({cpp_value}, {isolate})', |
| 'DOMString': 'v8String({isolate}, {cpp_value})', |
| + 'ByteString': 'v8String({isolate}, {cpp_value})', |
| 'boolean': 'v8Boolean({cpp_value}, {isolate})', |
| 'int': 'v8::Integer::New({isolate}, {cpp_value})', |
| 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})', |