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 08ffb704751d77a0b2702dd343083d8b4fbbabcc..4d65056cf7e10379bbcc8024ebaf8fb731f26913 100644 |
| --- a/third_party/WebKit/Source/bindings/scripts/v8_types.py |
| +++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py |
| @@ -212,6 +212,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ |
| idl_type_name = "Or".join(member_cpp_name(member) |
| for member in idl_type.member_types) |
| return 'const %s&' % idl_type_name if used_as_rvalue_type else idl_type_name |
| + if idl_type.is_experimental_callback_function: |
| + return 'V8' + base_idl_type + '*' |
| # Default, assume native type is a pointer with same type name as idl type |
| return base_idl_type + '*' |
| @@ -381,6 +383,8 @@ def includes_for_type(idl_type, extended_attributes=None): |
| if base_idl_type.endswith('Constructor'): |
| # FIXME: replace with a [ConstructorAttribute] extended attribute |
| base_idl_type = idl_type.constructor_type_name |
| + if idl_type.is_experimental_callback_function: |
| + return set(['bindings/core/v8/V8TestCallback.h']) |
|
Yuki
2016/09/07 08:27:12
You'd like to do something similar to line 372.
Av
lkawai
2016/09/08 09:11:31
Done.
|
| if base_idl_type not in component_dir: |
| return set() |
| return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], |
| @@ -573,6 +577,9 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
| cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {variable_name}, %s, exceptionState)' % nullable |
| elif idl_type.use_output_parameter_for_result: |
| cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {variable_name}, exceptionState)' |
| + elif idl_type.is_experimental_callback_function: |
| + cpp_expression_format = ( |
| + 'V8{idl_type}::create(v8::Local<v8::Function>::Cast({v8_value}), info.Holder(), ScriptState::current({isolate}))') |
| else: |
| cpp_expression_format = ( |
| 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') |
| @@ -641,7 +648,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl |
| check_expression = '!%s.prepare(exceptionState)' % variable_name |
| else: |
| check_expression = '!%s.prepare()' % variable_name |
| - elif not idl_type.v8_conversion_is_trivial: |
| + elif not idl_type.v8_conversion_is_trivial and not idl_type.is_callback_function: |
| return { |
| 'error_message': 'no V8 -> C++ conversion for IDL type: %s' % idl_type.name |
| } |
| @@ -688,6 +695,8 @@ def preprocess_idl_type(idl_type): |
| if idl_type.is_enum: |
| # Enumerations are internally DOMStrings |
| return IdlType('DOMString') |
| + if idl_type.is_experimental_callback_function: |
| + return idl_type |
| if idl_type.base_type in ['any', 'object'] or idl_type.is_callback_function: |
| return IdlType('ScriptValue') |
| return idl_type |