Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: Source/bindings/scripts/v8_callback_interface.py

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased onto callback change Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/v8_callback_interface.py
diff --git a/Source/bindings/scripts/v8_callback_interface.py b/Source/bindings/scripts/v8_callback_interface.py
index ceb7c99ed5a70e7f591fb6bd24a8a8a9edf623fc..55acbcbf0d9c50008f92cf779149a19435b68a3f 100644
--- a/Source/bindings/scripts/v8_callback_interface.py
+++ b/Source/bindings/scripts/v8_callback_interface.py
@@ -29,7 +29,7 @@
"""Generate template values for a callback interface."""
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',
@@ -86,16 +86,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)
@@ -105,8 +107,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],
}

Powered by Google App Engine
This is Rietveld 408576698