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

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: Move out of Source/wtf 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
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 298
297 299
298 def v8_value_to_local_cpp_value(argument, index): 300 def v8_value_to_local_cpp_value(argument, index):
299 extended_attributes = argument.extended_attributes 301 extended_attributes = argument.extended_attributes
300 idl_type = argument.idl_type 302 idl_type = argument.idl_type
301 name = argument.name 303 name = argument.name
302 if argument.is_variadic: 304 if argument.is_variadic:
303 return v8_value_to_local_cpp_variadic_value(argument, index) 305 return v8_value_to_local_cpp_variadic_value(argument, index)
304 # FIXME: This special way of handling string arguments with null defaults 306 # FIXME: This special way of handling string arguments with null defaults
305 # can go away once we fully support default values. 307 # can go away once we fully support default values.
306 if (argument.is_optional and idl_type.name in ('String', 'ByteString') and 308 if (argument.is_optional and
309 idl_type.name in ('String', 'ByteString', 'ScalarValueString') and
307 argument.default_value and argument.default_value.is_null): 310 argument.default_value and argument.default_value.is_null):
308 v8_value = 'argumentOrNull(info, %s)' % index 311 v8_value = 'argumentOrNull(info, %s)' % index
309 else: 312 else:
310 v8_value = 'info[%s]' % index 313 v8_value = 'info[%s]' % index
311 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, 314 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
312 name, index=index, declare_varia ble=False) 315 name, index=index, declare_varia ble=False)
313 316
314 317
315 ################################################################################ 318 ################################################################################
316 # Auxiliary functions 319 # Auxiliary functions
(...skipping 13 matching lines...) Expand all
330 333
331 334
332 def union_arguments(idl_type): 335 def union_arguments(idl_type):
333 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 336 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
334 return [arg 337 return [arg
335 for i in range(len(idl_type.member_types)) 338 for i in range(len(idl_type.member_types))
336 for arg in ['result%sEnabled' % i, 'result%s' % i]] 339 for arg in ['result%sEnabled' % i, 'result%s' % i]]
337 340
338 IdlType.union_arguments = property(lambda self: None) 341 IdlType.union_arguments = property(lambda self: None)
339 IdlUnionType.union_arguments = property(union_arguments) 342 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698