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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' | 242 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' |
243 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, release=release, for_main_world=for_main_world) | 243 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w
rappable=script_wrappable, release=release, for_main_world=for_main_world) |
244 | 244 |
245 | 245 |
246 def v8_value_to_local_cpp_value(argument, index): | 246 def v8_value_to_local_cpp_value(argument, index): |
247 extended_attributes = argument.extended_attributes | 247 extended_attributes = argument.extended_attributes |
248 idl_type = argument.idl_type | 248 idl_type = argument.idl_type |
249 name = argument.name | 249 name = argument.name |
250 if argument.is_variadic: | 250 if argument.is_variadic: |
251 vector_type = v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_
type) | 251 vector_type = v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_
type) |
252 return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgum
ents<{cpp_type}>(info, {index}))'.format( | 252 return 'TONATIVE_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgumen
ts<{cpp_type}>(info, {index}))'.format( |
253 cpp_type=idl_type.cpp_type, name=name, index=index, vector_type=
vector_type) | 253 cpp_type=idl_type.cpp_type, name=name, index=index, vector_type=vect
or_type) |
254 # [Default=NullString] | 254 # [Default=NullString] |
255 if (argument.is_optional and idl_type.name == 'String' and | 255 if (argument.is_optional and idl_type.name == 'String' and |
256 extended_attributes.get('Default') == 'NullString'): | 256 extended_attributes.get('Default') == 'NullString'): |
257 v8_value = 'argumentOrNull(info, %s)' % index | 257 v8_value = 'argumentOrNull(info, %s)' % index |
258 else: | 258 else: |
259 v8_value = 'info[%s]' % index | 259 v8_value = 'info[%s]' % index |
260 return idl_type.v8_value_to_local_cpp_value(argument.extended_attributes, | 260 return idl_type.v8_value_to_local_cpp_value(argument.extended_attributes, |
261 v8_value, name, index=index) | 261 v8_value, name, index=index) |
262 | 262 |
263 | 263 |
(...skipping 15 matching lines...) Expand all Loading... |
279 | 279 |
280 | 280 |
281 def union_arguments(idl_type): | 281 def union_arguments(idl_type): |
282 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 282 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
283 return [arg | 283 return [arg |
284 for i in range(len(idl_type.member_types)) | 284 for i in range(len(idl_type.member_types)) |
285 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 285 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
286 | 286 |
287 IdlType.union_arguments = property(lambda self: None) | 287 IdlType.union_arguments = property(lambda self: None) |
288 IdlUnionType.union_arguments = property(union_arguments) | 288 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |