Index: Source/bindings/scripts/unstable/v8_callback_interface.py |
diff --git a/Source/bindings/scripts/unstable/v8_callback_interface.py b/Source/bindings/scripts/unstable/v8_callback_interface.py |
index c122daba42075e936f5fc4238ea98af9afc6c1da..fdbdfaa785412892fe7fac2a8949c2cb91b5bc16 100644 |
--- a/Source/bindings/scripts/unstable/v8_callback_interface.py |
+++ b/Source/bindings/scripts/unstable/v8_callback_interface.py |
@@ -36,7 +36,7 @@ For details, see bug http://crbug.com/239771 |
""" |
from v8_types import cpp_type, cpp_value_to_v8_value, includes_for_type |
-from v8_utilities import v8_class_name |
+from v8_utilities import v8_class_name, has_extended_attribute_value |
CALLBACK_INTERFACE_H_INCLUDES = set([ |
'bindings/v8/ActiveDOMCallback.h', |
@@ -94,16 +94,18 @@ def includes_for_operation(operation): |
def generate_method_contents(operation): |
+ call_with_this_handle = has_extended_attribute_value(operation.extended_attributes, 'CallWith', 'ThisValue') |
contents = { |
'name': operation.name, |
'return_cpp_type': cpp_type(operation.data_type, 'RefPtr'), |
'custom': 'Custom' in operation.extended_attributes, |
+ 'call_with_this_handle': call_with_this_handle, |
} |
- contents.update(generate_arguments_contents(operation.arguments)) |
+ contents.update(generate_arguments_contents(operation.arguments, call_with_this_handle)) |
return contents |
-def generate_arguments_contents(arguments): |
+def generate_arguments_contents(arguments, call_with_this_handle): |
def argument_declaration(argument): |
return '%s %s' % (cpp_type(argument.data_type), argument.name) |
@@ -113,8 +115,11 @@ def generate_arguments_contents(arguments): |
'cpp_to_v8_conversion': cpp_to_v8_conversion(argument.data_type, argument.name), |
} |
+ argument_declarations = [argument_declaration(argument) for argument in arguments] |
+ if call_with_this_handle: |
+ argument_declarations.insert(0, 'ScriptValue thisValue') |
return { |
- 'argument_declarations': [argument_declaration(argument) for argument in arguments], |
+ 'argument_declarations': argument_declarations, |
'arguments': [generate_argument(argument) for argument in arguments], |
'handles': ['%sHandle' % argument.name for argument in arguments], |
} |