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 eedd1e46ffcc382849130ed6c99b35a512de166c..601d6112e79b9846724e8c4a19b39a72e4311f02 100644 |
| --- a/Source/bindings/scripts/v8_types.py |
| +++ b/Source/bindings/scripts/v8_types.py |
| @@ -476,9 +476,9 @@ V8_VALUE_TO_CPP_VALUE = { |
| 'ByteString': 'toByteString({arguments})', |
| 'USVString': 'toUSVString({arguments})', |
| 'boolean': '{v8_value}->BooleanValue()', |
| - 'float': 'toFloat({arguments})', |
| + 'float': 'toRestrictedFloat({arguments})', |
| 'unrestricted float': 'toFloat({arguments})', |
| - 'double': 'toDouble({arguments})', |
| + 'double': 'toRestrictedDouble({arguments})', |
| 'unrestricted double': 'toDouble({arguments})', |
| 'byte': 'toInt8({arguments})', |
| 'octet': 'toUInt8({arguments})', |
| @@ -530,7 +530,7 @@ def v8_conversion_is_trivial(idl_type): |
| IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) |
| -def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index, isolate): |
| +def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index, isolate, restricted_float=False): |
| if idl_type.name == 'void': |
| return '' |
| @@ -554,6 +554,8 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
| arguments = v8_value |
| if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
| + if base_idl_type in ('float', 'double') and not restricted_float: |
|
haraken
2015/01/22 02:43:06
Shall we add a FIXME and mention that we should ha
Jens Widell
2015/01/22 06:59:10
Comment added.
|
| + base_idl_type = 'unrestricted ' + base_idl_type |
| cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
| elif idl_type.is_array_buffer_or_view: |
| cpp_expression_format = ( |
| @@ -592,7 +594,7 @@ def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value, |
| # FIXME: this function should be refactored, as this takes too many flags. |
| -def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name=None, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False, needs_exception_state_for_string=False): |
| +def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name=None, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False, needs_exception_state_for_string=False, restricted_float=False): |
| """Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" |
| this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, raw_type=True) |
| @@ -601,7 +603,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl |
| if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener'): |
| return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name |
| - cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index, isolate) |
| + cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index, isolate, restricted_float=restricted_float) |
| if idl_type.is_dictionary or idl_type.is_union_type: |
| return 'TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(%s, exceptionState)' % cpp_value |