| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 'float': 'v8SetReturnValue(info, {cpp_value})', | 584 'float': 'v8SetReturnValue(info, {cpp_value})', |
| 585 'double': 'v8SetReturnValue(info, {cpp_value})', | 585 'double': 'v8SetReturnValue(info, {cpp_value})', |
| 586 # No special v8SetReturnValue* function, but instead convert value to V8 | 586 # No special v8SetReturnValue* function, but instead convert value to V8 |
| 587 # and then use general v8SetReturnValue. | 587 # and then use general v8SetReturnValue. |
| 588 'array': 'v8SetReturnValue(info, {cpp_value})', | 588 'array': 'v8SetReturnValue(info, {cpp_value})', |
| 589 'Date': 'v8SetReturnValue(info, {cpp_value})', | 589 'Date': 'v8SetReturnValue(info, {cpp_value})', |
| 590 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', | 590 'EventHandler': 'v8SetReturnValue(info, {cpp_value})', |
| 591 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 591 'ScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 592 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', | 592 'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})', |
| 593 # DOMWrapper | 593 # DOMWrapper |
| 594 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, {cpp_value})', | 594 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({c
pp_value}))', |
| 595 'DOMWrapperFast': 'v8SetReturnValueFast(info, {cpp_value}, {script_wrappable
})', | 595 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {scr
ipt_wrappable})', |
| 596 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', | 596 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', |
| 597 } | 597 } |
| 598 | 598 |
| 599 | 599 |
| 600 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr
appable='', release=False, for_main_world=False): | 600 def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr
appable='', release=False, for_main_world=False): |
| 601 """Returns a statement that converts a C++ value to a V8 value and sets it a
s a return value. | 601 """Returns a statement that converts a C++ value to a V8 value and sets it a
s a return value. |
| 602 | 602 |
| 603 release: for union types, can be either False (False for all member types) | 603 release: for union types, can be either False (False for all member types) |
| 604 or a sequence (list or tuple) of booleans (if specified | 604 or a sequence (list or tuple) of booleans (if specified |
| 605 individually). | 605 individually). |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 657 |
| 658 | 658 |
| 659 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='', extended_attributes=None): | 659 def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', crea
tion_context='', extended_attributes=None): |
| 660 """Returns an expression that converts a C++ value to a V8 value.""" | 660 """Returns an expression that converts a C++ value to a V8 value.""" |
| 661 # the isolate parameter is needed for callback interfaces | 661 # the isolate parameter is needed for callback interfaces |
| 662 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) | 662 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) |
| 663 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes) | 663 this_v8_conversion_type = v8_conversion_type(idl_type, extended_attributes) |
| 664 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] | 664 format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type] |
| 665 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) | 665 statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creat
ion_context=creation_context) |
| 666 return statement | 666 return statement |
| OLD | NEW |