OLD | NEW |
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 'idl_type': idl_type.base_type, | 233 'idl_type': idl_type.base_type, |
234 'idl_type_object': idl_type, | 234 'idl_type_object': idl_type, |
235 'index': index, | 235 'index': index, |
236 'is_callback_function': idl_type.is_callback_function, | 236 'is_callback_function': idl_type.is_callback_function, |
237 'is_callback_interface': idl_type.is_callback_interface, | 237 'is_callback_interface': idl_type.is_callback_interface, |
238 # FIXME: Remove generic 'Dictionary' special-casing | 238 # FIXME: Remove generic 'Dictionary' special-casing |
239 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio
nary', | 239 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio
nary', |
240 'is_explicit_nullable': idl_type.is_explicit_nullable, | 240 'is_explicit_nullable': idl_type.is_explicit_nullable, |
241 'is_nullable': idl_type.is_nullable, | 241 'is_nullable': idl_type.is_nullable, |
242 'is_optional': argument.is_optional, | 242 'is_optional': argument.is_optional, |
| 243 'is_small_typed_array': idl_type.name == 'SmallTypedArray', |
243 'is_variadic': argument.is_variadic, | 244 'is_variadic': argument.is_variadic, |
244 'is_variadic_wrapper_type': is_variadic_wrapper_type, | 245 'is_variadic_wrapper_type': is_variadic_wrapper_type, |
245 'is_wrapper_type': idl_type.is_wrapper_type, | 246 'is_wrapper_type': idl_type.is_wrapper_type, |
246 'name': argument.name, | 247 'name': argument.name, |
247 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 248 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
248 argument.name, isolate='scriptState->isolate()', | 249 argument.name, isolate='scriptState->isolate()', |
249 creation_context='scriptState->context()->Global()'), | 250 creation_context='scriptState->context()->Global()'), |
250 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, | 251 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, |
251 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 252 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
252 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 253 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
(...skipping 14 matching lines...) Expand all Loading... |
267 | 268 |
268 ################################################################################ | 269 ################################################################################ |
269 # Value handling | 270 # Value handling |
270 ################################################################################ | 271 ################################################################################ |
271 | 272 |
272 def cpp_value(interface, method, number_of_arguments): | 273 def cpp_value(interface, method, number_of_arguments): |
273 def cpp_argument(argument): | 274 def cpp_argument(argument): |
274 idl_type = argument.idl_type | 275 idl_type = argument.idl_type |
275 if idl_type.name == 'EventListener': | 276 if idl_type.name == 'EventListener': |
276 return argument.name | 277 return argument.name |
| 278 if idl_type.name == 'SmallTypedArray': |
| 279 return '%s.first, %s.second' % (argument.name, argument.name) |
277 if (idl_type.name in ['NodeFilter', 'NodeFilterOrNull', | 280 if (idl_type.name in ['NodeFilter', 'NodeFilterOrNull', |
278 'XPathNSResolver', 'XPathNSResolverOrNull']): | 281 'XPathNSResolver', 'XPathNSResolverOrNull']): |
279 # FIXME: remove this special case | 282 # FIXME: remove this special case |
280 return '%s.release()' % argument.name | 283 return '%s.release()' % argument.name |
281 return argument.name | 284 return argument.name |
282 | 285 |
283 # Truncate omitted optional arguments | 286 # Truncate omitted optional arguments |
284 arguments = method.arguments[:number_of_arguments] | 287 arguments = method.arguments[:number_of_arguments] |
285 cpp_arguments = [] | 288 cpp_arguments = [] |
286 if 'ImplementedInPrivateScript' in method.extended_attributes: | 289 if 'ImplementedInPrivateScript' in method.extended_attributes: |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return method.idl_type and method.idl_type.name == 'Promise' | 455 return method.idl_type and method.idl_type.name == 'Promise' |
453 | 456 |
454 IdlOperation.returns_promise = property(method_returns_promise) | 457 IdlOperation.returns_promise = property(method_returns_promise) |
455 | 458 |
456 | 459 |
457 def argument_conversion_needs_exception_state(method, argument): | 460 def argument_conversion_needs_exception_state(method, argument): |
458 idl_type = argument.idl_type | 461 idl_type = argument.idl_type |
459 return (idl_type.v8_conversion_needs_exception_state or | 462 return (idl_type.v8_conversion_needs_exception_state or |
460 argument.is_variadic or | 463 argument.is_variadic or |
461 (method.returns_promise and idl_type.is_string_type)) | 464 (method.returns_promise and idl_type.is_string_type)) |
OLD | NEW |