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

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: 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', 112 ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable',
113 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), 113 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])),
114 'function_template': function_template(), 114 'function_template': function_template(),
115 'idl_type': idl_type.base_type, 115 'idl_type': idl_type.base_type,
116 'has_event_listener_argument': has_event_listener_argument, 116 'has_event_listener_argument': has_event_listener_argument,
117 'has_exception_state': 117 'has_exception_state':
118 has_event_listener_argument or 118 has_event_listener_argument or
119 is_raises_exception or 119 is_raises_exception or
120 is_check_security_for_frame or 120 is_check_security_for_frame or
121 any(argument for argument in arguments 121 any(argument for argument in arguments
122 if argument.idl_type.name in ('ByteString', 'SerializedScriptVal ue') or 122 if argument.idl_type.name in ('ByteString', 'ScalarValueString', 'SerializedScriptValue') or
Nils Barth (inactive) 2014/06/11 03:54:26 Could you wrap this line?
jsbell 2014/06/12 17:45:55 Done.
123 argument.idl_type.is_integer_type), 123 argument.idl_type.is_integer_type),
124 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 124 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
125 'is_call_with_script_arguments': is_call_with_script_arguments, 125 'is_call_with_script_arguments': is_call_with_script_arguments,
126 'is_call_with_script_state': is_call_with_script_state, 126 'is_call_with_script_state': is_call_with_script_state,
127 'is_check_security_for_frame': is_check_security_for_frame, 127 'is_check_security_for_frame': is_check_security_for_frame,
128 'is_check_security_for_node': is_check_security_for_node, 128 'is_check_security_for_node': is_check_security_for_node,
129 'is_custom': 'Custom' in extended_attributes, 129 'is_custom': 'Custom' in extended_attributes,
130 'is_custom_element_callbacks': is_custom_element_callbacks, 130 'is_custom_element_callbacks': is_custom_element_callbacks,
131 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, 131 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
132 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s, 132 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return '%s(%s)' % (macro, ', '.join(macro_args)) 279 return '%s(%s)' % (macro, ', '.join(macro_args))
280 280
281 281
282 def v8_value_to_local_cpp_value(argument, index): 282 def v8_value_to_local_cpp_value(argument, index):
283 extended_attributes = argument.extended_attributes 283 extended_attributes = argument.extended_attributes
284 idl_type = argument.idl_type 284 idl_type = argument.idl_type
285 name = argument.name 285 name = argument.name
286 if argument.is_variadic: 286 if argument.is_variadic:
287 return v8_value_to_local_cpp_variadic_value(argument, index) 287 return v8_value_to_local_cpp_variadic_value(argument, index)
288 # [Default=NullString] 288 # [Default=NullString]
289 if (argument.is_optional and idl_type.name == 'String' and 289 if (argument.is_optional and idl_type.name in ('String', 'ByteString', 'Scal arValueString') and
Nils Barth (inactive) 2014/06/11 03:54:26 Break/wrap?
jsbell 2014/06/12 17:45:55 Done.
290 extended_attributes.get('Default') == 'NullString'): 290 extended_attributes.get('Default') == 'NullString'):
291 v8_value = 'argumentOrNull(info, %s)' % index 291 v8_value = 'argumentOrNull(info, %s)' % index
292 else: 292 else:
293 v8_value = 'info[%s]' % index 293 v8_value = 'info[%s]' % index
294 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, 294 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
295 name, index=index, declare_varia ble=False) 295 name, index=index, declare_varia ble=False)
296 296
297 297
298 ################################################################################ 298 ################################################################################
299 # Auxiliary functions 299 # Auxiliary functions
(...skipping 13 matching lines...) Expand all
313 313
314 314
315 def union_arguments(idl_type): 315 def union_arguments(idl_type):
316 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 316 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
317 return [arg 317 return [arg
318 for i in range(len(idl_type.member_types)) 318 for i in range(len(idl_type.member_types))
319 for arg in ['result%sEnabled' % i, 'result%s' % i]] 319 for arg in ['result%sEnabled' % i, 'result%s' % i]]
320 320
321 IdlType.union_arguments = property(lambda self: None) 321 IdlType.union_arguments = property(lambda self: None)
322 IdlUnionType.union_arguments = property(union_arguments) 322 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698