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

Side by Side Diff: Source/bindings/scripts/v8_methods.py

Issue 313993002: Bindings: Add ScalarValueString support (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 'function_template': function_template(), 124 'function_template': function_template(),
125 'has_custom_registration': is_static or 125 'has_custom_registration': is_static or
126 v8_utilities.has_extended_attribute( 126 v8_utilities.has_extended_attribute(
127 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), 127 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
128 'has_event_listener_argument': has_event_listener_argument, 128 'has_event_listener_argument': has_event_listener_argument,
129 'has_exception_state': 129 'has_exception_state':
130 has_event_listener_argument or 130 has_event_listener_argument or
131 is_raises_exception or 131 is_raises_exception or
132 is_check_security_for_frame or 132 is_check_security_for_frame or
133 any(argument for argument in arguments 133 any(argument for argument in arguments
134 if argument.idl_type.name in ('ByteString', 'SerializedScriptVal ue') or 134 if argument.idl_type.name in ('ByteString',
135 'ScalarValueString',
136 'SerializedScriptValue') or
135 argument.idl_type.is_integer_type), 137 argument.idl_type.is_integer_type),
136 'idl_type': idl_type.base_type, 138 'idl_type': idl_type.base_type,
137 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 139 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
138 'is_call_with_script_arguments': is_call_with_script_arguments, 140 'is_call_with_script_arguments': is_call_with_script_arguments,
139 'is_call_with_script_state': is_call_with_script_state, 141 'is_call_with_script_state': is_call_with_script_state,
140 'is_check_security_for_frame': is_check_security_for_frame, 142 'is_check_security_for_frame': is_check_security_for_frame,
141 'is_check_security_for_node': is_check_security_for_node, 143 'is_check_security_for_node': is_check_security_for_node,
142 'is_custom': 'Custom' in extended_attributes, 144 'is_custom': 'Custom' in extended_attributes,
143 'is_custom_element_callbacks': is_custom_element_callbacks, 145 'is_custom_element_callbacks': is_custom_element_callbacks,
144 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, 146 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 305
304 306
305 def v8_value_to_local_cpp_value(argument, index): 307 def v8_value_to_local_cpp_value(argument, index):
306 extended_attributes = argument.extended_attributes 308 extended_attributes = argument.extended_attributes
307 idl_type = argument.idl_type 309 idl_type = argument.idl_type
308 name = argument.name 310 name = argument.name
309 if argument.is_variadic: 311 if argument.is_variadic:
310 return v8_value_to_local_cpp_variadic_value(argument, index) 312 return v8_value_to_local_cpp_variadic_value(argument, index)
311 # FIXME: This special way of handling string arguments with null defaults 313 # FIXME: This special way of handling string arguments with null defaults
312 # can go away once we fully support default values. 314 # can go away once we fully support default values.
313 if (argument.is_optional and idl_type.name in ('String', 'ByteString') and 315 if (argument.is_optional and
316 idl_type.name in ('String', 'ByteString', 'ScalarValueString') and
314 argument.default_value and argument.default_value.is_null): 317 argument.default_value and argument.default_value.is_null):
315 v8_value = 'argumentOrNull(info, %s)' % index 318 v8_value = 'argumentOrNull(info, %s)' % index
316 else: 319 else:
317 v8_value = 'info[%s]' % index 320 v8_value = 'info[%s]' % index
318 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, 321 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
319 name, index=index, declare_varia ble=False) 322 name, index=index, declare_varia ble=False)
320 323
321 324
322 ################################################################################ 325 ################################################################################
323 # Auxiliary functions 326 # Auxiliary functions
(...skipping 13 matching lines...) Expand all
337 340
338 341
339 def union_arguments(idl_type): 342 def union_arguments(idl_type):
340 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 343 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
341 return [arg 344 return [arg
342 for i in range(len(idl_type.member_types)) 345 for i in range(len(idl_type.member_types))
343 for arg in ['result%sEnabled' % i, 'result%s' % i]] 346 for arg in ['result%sEnabled' % i, 'result%s' % i]]
344 347
345 IdlType.union_arguments = property(lambda self: None) 348 IdlType.union_arguments = property(lambda self: None)
346 IdlUnionType.union_arguments = property(union_arguments) 349 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698