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

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

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reverted .tmpl rename Created 7 years, 4 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/code_generator_v8.py
diff --git a/Source/bindings/scripts/code_generator_v8.py b/Source/bindings/scripts/code_generator_v8.py
index 41e81fdaae08a507ec9365f5c4e5ecb204048477..3bc321f396f963b7091cf66fcd4f100bb6571c06 100644
--- a/Source/bindings/scripts/code_generator_v8.py
+++ b/Source/bindings/scripts/code_generator_v8.py
@@ -209,6 +209,19 @@ def v8_class_name(interface):
return v8_type(interface.name)
+def has_extended_attribute_value(extended_attributes, key, value):
+ return key in extended_attributes and value in extended_attribute_values(extended_attributes, key)
+
+
+def extended_attribute_values(extended_attributes, key):
+ if key not in extended_attributes:
+ return None
+ values_string = extended_attributes[key]
+ if not values_string:
+ return []
+ return re.split('[|&]', values_string)
+
+
class CodeGeneratorV8:
def __init__(self, definitions, interface_name, output_directory, relative_dir_posix, idl_directories, verbose=False):
self.idl_definitions = definitions
@@ -323,6 +336,7 @@ class CodeGeneratorV8:
def argument_declaration(argument):
return '%s %s' % (cpp_type(argument.data_type, 'raw'), argument.name)
+ call_with_this_handle = has_extended_attribute_value(operation.extended_attributes, 'CallWith', 'ThisValue')
arguments = []
custom = 'Custom' in operation.extended_attributes
if not custom:
@@ -330,11 +344,15 @@ class CodeGeneratorV8:
if operation.data_type != 'boolean':
raise Exception("We don't yet support callbacks that return non-boolean values.")
arguments = [generate_argument(argument) for argument in operation.arguments]
+ argument_declaration = ', '.join([argument_declaration(argument) for argument in operation.arguments])
arv (Not doing code reviews) 2013/08/07 14:16:23 No need for temp array: argument_declaration = ',
alancutter (OOO until 2018) 2013/08/08 01:50:57 I just realised I'm clobbering the argument_declar
+ if call_with_this_handle:
+ argument_declaration = 'ScriptValue thisValue, ' + argument_declaration
method = {
+ 'call_with_this_handle': call_with_this_handle,
'return_cpp_type': cpp_type(operation.data_type, 'RefPtr'),
'name': operation.name,
'arguments': arguments,
- 'argument_declaration': ', '.join([argument_declaration(argument) for argument in operation.arguments]),
+ 'argument_declaration': argument_declaration,
'handles': ', '.join(['%sHandle' % argument.name for argument in operation.arguments]),
'custom': custom,
}

Powered by Google App Engine
This is Rietveld 408576698