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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 'V8{idl_type}::HasInstance({v8_value}, {isolate}, worldType({isolate
})) ? ' | 386 'V8{idl_type}::HasInstance({v8_value}, {isolate}, worldType({isolate
})) ? ' |
387 'V8{idl_type}::toNative(v8::Handle<v8::Object>::Cast({v8_value})) :
0') | 387 'V8{idl_type}::toNative(v8::Handle<v8::Object>::Cast({v8_value})) :
0') |
388 includes.update(includes_for_type(idl_type)) | 388 includes.update(includes_for_type(idl_type)) |
389 | 389 |
390 return cpp_expression_format.format(arguments=arguments, idl_type=idl_type,
isolate=isolate, v8_value=v8_value) | 390 return cpp_expression_format.format(arguments=arguments, idl_type=idl_type,
isolate=isolate, v8_value=v8_value) |
391 | 391 |
392 | 392 |
393 def v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_valu
e, includes, isolate): | 393 def v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_valu
e, includes, isolate): |
394 if is_interface_type(this_array_or_sequence_type): | 394 if is_interface_type(this_array_or_sequence_type): |
395 this_cpp_type = None | 395 this_cpp_type = None |
396 expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{a
rray_or_sequence_type}>({v8_value}, {isolate}))' | 396 expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{a
rray_or_sequence_type}>({v8_value}, 0, {isolate}))' |
397 includes.add('V8%s.h' % this_array_or_sequence_type) | 397 includes.add('V8%s.h' % this_array_or_sequence_type) |
398 else: | 398 else: |
399 this_cpp_type = cpp_type(this_array_or_sequence_type) | 399 this_cpp_type = cpp_type(this_array_or_sequence_type) |
400 expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {isolate})' | 400 expression_format = 'toNativeArray<{cpp_type}>({v8_value}, 0, {isolate})
' |
401 expression = expression_format.format(array_or_sequence_type=this_array_or_s
equence_type, cpp_type=this_cpp_type, isolate=isolate, v8_value=v8_value) | 401 expression = expression_format.format(array_or_sequence_type=this_array_or_s
equence_type, cpp_type=this_cpp_type, isolate=isolate, v8_value=v8_value) |
402 return expression | 402 return expression |
403 | 403 |
404 | 404 |
405 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name, includes, isolate): | 405 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name, includes, isolate): |
406 """Returns an expression that converts a V8 value to a C++ value and stores
it as a local value.""" | 406 """Returns an expression that converts a V8 value to a C++ value and stores
it as a local value.""" |
407 this_cpp_type = cpp_type(idl_type, extended_attributes=extended_attributes,
used_as_argument=True) | 407 this_cpp_type = cpp_type(idl_type, extended_attributes=extended_attributes,
used_as_argument=True) |
408 | 408 |
409 idl_type = preprocess_idl_type(idl_type) | 409 idl_type = preprocess_idl_type(idl_type) |
410 if idl_type == 'DOMString': | 410 if idl_type == 'DOMString': |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 560 } |
561 | 561 |
562 | 562 |
563 def cpp_value_to_v8_value(idl_type, cpp_value, includes, isolate, callback_info=
'', creation_context='', extended_attributes=None): | 563 def cpp_value_to_v8_value(idl_type, cpp_value, includes, isolate, callback_info=
'', creation_context='', extended_attributes=None): |
564 """Returns an expression that converts a C++ value to a V8 value.""" | 564 """Returns an expression that converts a C++ value to a V8 value.""" |
565 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) | 565 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) |
566 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes,
includes) | 566 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes,
includes) |
567 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] | 567 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] |
568 statement = format_string.format(callback_info=callback_info, cpp_value=cpp_
value, creation_context=creation_context, isolate=isolate) | 568 statement = format_string.format(callback_info=callback_info, cpp_value=cpp_
value, creation_context=creation_context, isolate=isolate) |
569 return statement | 569 return statement |
OLD | NEW |