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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 extended_attributes, | 660 extended_attributes, |
661 script_wrappable, | 661 script_wrappable, |
662 release and release[i], | 662 release and release[i], |
663 for_main_world) | 663 for_main_world) |
664 for i, member_type in | 664 for i, member_type in |
665 enumerate(idl_type.member_types)] | 665 enumerate(idl_type.member_types)] |
666 | 666 |
667 IdlType.v8_set_return_value = v8_set_return_value | 667 IdlType.v8_set_return_value = v8_set_return_value |
668 IdlUnionType.v8_set_return_value = v8_set_return_value_union | 668 IdlUnionType.v8_set_return_value = v8_set_return_value_union |
669 | 669 |
670 IdlType.release = property(lambda self: self.is_interface_type) | 670 |
671 IdlUnionType.release = property( | 671 def type_needs_release(idl_type): |
672 lambda self: [member_type.is_interface_type | 672 return idl_type.is_interface_type and idl_type.base_type != 'SerializedScrip
tValue' |
673 for member_type in self.member_types]) | 673 |
| 674 |
| 675 def union_type_needs_release(idl_type): |
| 676 return [type_needs_release(member_type) |
| 677 for member_type in idl_type.member_types] |
| 678 |
| 679 IdlType.release = property(type_needs_release) |
| 680 IdlUnionType.release = property(union_type_needs_release) |
674 | 681 |
675 | 682 |
676 CPP_VALUE_TO_V8_VALUE = { | 683 CPP_VALUE_TO_V8_VALUE = { |
677 # Built-in types | 684 # Built-in types |
678 'Date': 'v8DateOrNaN({cpp_value}, {isolate})', | 685 'Date': 'v8DateOrNaN({cpp_value}, {isolate})', |
679 'DOMString': 'v8String({isolate}, {cpp_value})', | 686 'DOMString': 'v8String({isolate}, {cpp_value})', |
680 'ByteString': 'v8String({isolate}, {cpp_value})', | 687 'ByteString': 'v8String({isolate}, {cpp_value})', |
681 'ScalarValueString': 'v8String({isolate}, {cpp_value})', | 688 'ScalarValueString': 'v8String({isolate}, {cpp_value})', |
682 'boolean': 'v8Boolean({cpp_value}, {isolate})', | 689 'boolean': 'v8Boolean({cpp_value}, {isolate})', |
683 'int': 'v8::Integer::New({isolate}, {cpp_value})', | 690 'int': 'v8::Integer::New({isolate}, {cpp_value})', |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 # - String types (String/AtomicString) represent null as a null string, | 735 # - String types (String/AtomicString) represent null as a null string, |
729 # i.e. one for which String::isNull() returns true. | 736 # i.e. one for which String::isNull() returns true. |
730 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as | 737 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as |
731 # a null pointer. | 738 # a null pointer. |
732 return idl_type.is_nullable and ( | 739 return idl_type.is_nullable and ( |
733 (idl_type.is_string_type or idl_type.is_wrapper_type) and | 740 (idl_type.is_string_type or idl_type.is_wrapper_type) and |
734 not idl_type.native_array_element_type) | 741 not idl_type.native_array_element_type) |
735 | 742 |
736 IdlType.is_nullable_simple = property(is_nullable_simple) | 743 IdlType.is_nullable_simple = property(is_nullable_simple) |
737 IdlUnionType.is_nullable_simple = False | 744 IdlUnionType.is_nullable_simple = False |
OLD | NEW |