Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/scripts/v8_types.py |
| diff --git a/third_party/WebKit/Source/bindings/scripts/v8_types.py b/third_party/WebKit/Source/bindings/scripts/v8_types.py |
| index d3e21143b23827961c717806b9d2ee5a557c5e2a..fcdd34fc94e638210b4898a033adb8fa1fa7b598 100644 |
| --- a/third_party/WebKit/Source/bindings/scripts/v8_types.py |
| +++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py |
| @@ -365,7 +365,8 @@ def includes_for_type(idl_type, extended_attributes=None): |
| set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], base_idl_type)]) |
| ) |
| if idl_type.is_basic_type: |
| - return set() |
| + return set(['bindings/core/v8/IDLTypes.h', |
| + 'bindings/core/v8/NativeValueTraitsImpl.h']) |
|
haraken
2017/03/06 12:56:33
When should we include NativeValueTraits.h and whe
|
| if base_idl_type.endswith('ConstructorConstructor'): |
| # FIXME: rename to NamedConstructor |
| # FIXME: replace with a [NamedConstructorAttribute] extended attribute |
| @@ -476,29 +477,11 @@ def set_component_dirs(new_component_dirs): |
| V8_VALUE_TO_CPP_VALUE = { |
|
haraken
2017/03/06 12:56:33
Are you planning to remove the remaining things in
Raphael Kubo da Costa (rakuco)
2017/03/06 14:29:17
That'd be the final plan, though I still need to f
|
| # Basic |
| - 'Date': 'toCoreDate({isolate}, {v8_value}, exceptionState)', |
| 'DOMString': '{v8_value}', |
| - 'ByteString': 'toByteString({isolate}, {arguments})', |
| - 'USVString': 'toUSVString({isolate}, {arguments})', |
| - 'boolean': 'toBoolean({isolate}, {arguments})', |
| - 'float': 'toRestrictedFloat({isolate}, {arguments})', |
| - 'unrestricted float': 'toFloat({isolate}, {arguments})', |
| - 'double': 'toRestrictedDouble({isolate}, {arguments})', |
| - 'unrestricted double': 'toDouble({isolate}, {arguments})', |
| - 'byte': 'toInt8({isolate}, {arguments})', |
| - 'octet': 'toUInt8({isolate}, {arguments})', |
| - 'short': 'toInt16({isolate}, {arguments})', |
| - 'unsigned short': 'toUInt16({isolate}, {arguments})', |
| - 'long': 'toInt32({isolate}, {arguments})', |
| - 'unsigned long': 'toUInt32({isolate}, {arguments})', |
| - 'long long': 'toInt64({isolate}, {arguments})', |
| - 'unsigned long long': 'toUInt64({isolate}, {arguments})', |
| # Interface types |
| - 'Dictionary': 'Dictionary({isolate}, {v8_value}, exceptionState)', |
| 'FlexibleArrayBufferView': 'toFlexibleArrayBufferView({isolate}, {v8_value}, {variable_name}, allocateFlexibleArrayBufferViewStorage({v8_value}))', |
| 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current({isolate}))', |
| 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})', |
| - 'SerializedScriptValue': 'SerializedScriptValue::serialize({isolate}, {v8_value}, nullptr, nullptr, exceptionState)', |
| 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', |
| 'Window': 'toDOMWindow({isolate}, {v8_value})', |
| 'XPathNSResolver': 'toXPathNSResolver(ScriptState::current({isolate}), {v8_value})', |
| @@ -560,11 +543,12 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
| configuration = 'EnforceRange' |
| elif 'Clamp' in extended_attributes: |
| configuration = 'Clamp' |
| - arguments = ', '.join([v8_value, configuration, 'exceptionState']) |
| + arguments = ', '.join([v8_value, 'exceptionState', configuration]) |
| elif idl_type.v8_conversion_needs_exception_state: |
| arguments = ', '.join([v8_value, 'exceptionState']) |
| else: |
| arguments = v8_value |
| + |
| if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
| cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
| elif idl_type.is_array_buffer_or_view: |
| @@ -579,6 +563,17 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
| elif idl_type.is_callback_function: |
| cpp_expression_format = ( |
| '{idl_type}::create(ScriptState::current({isolate}), {v8_value})') |
| + elif idl_type.v8_conversion_needs_exception_state: |
| + # Effectively, this if branch means everything with v8_conversion_needs_exception_state == True |
| + # except for unions, sequences and dictionary interfaces. |
| + if idl_type.is_nullable: |
| + idl_type = idl_type.inner_type |
| + if idl_type.is_primitive_type or idl_type.name in ('ByteString', 'Date', 'Promise', 'USVString'): |
| + trait_type = 'IDL%s' % idl_type.name |
| + else: |
| + trait_type = idl_type.name |
|
haraken
2017/03/06 12:56:33
What types hit this branch?
Raphael Kubo da Costa (rakuco)
2017/03/06 14:29:17
Interfaces, unions, dictionaries etc. Basically an
|
| + cpp_expression_format = ( |
| + 'NativeValueTraits<%s>::nativeValue({isolate}, {arguments})' % trait_type) |
| else: |
| cpp_expression_format = ( |
| 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') |