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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: | 173 if base_idl_type in CPP_SPECIAL_CONVERSION_RULES: |
174 return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] | 174 return CPP_SPECIAL_CONVERSION_RULES[base_idl_type] |
175 | 175 |
176 if base_idl_type in NON_WRAPPER_TYPES: | 176 if base_idl_type in NON_WRAPPER_TYPES: |
177 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type | 177 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type |
178 if idl_type.is_string_type: | 178 if idl_type.is_string_type: |
179 if not raw_type: | 179 if not raw_type: |
180 return 'String' | 180 return 'String' |
181 return 'V8StringResource<%s>' % string_mode() | 181 return 'V8StringResource<%s>' % string_mode() |
182 | 182 |
| 183 if idl_type.is_callback_interface: |
| 184 ptr_type = 'RefPtr' if base_idl_type == 'EventListener' else 'OwnPtr' |
| 185 return cpp_template_type(ptr_type, base_idl_type) |
| 186 |
183 if idl_type.is_typed_array_element_type and raw_type: | 187 if idl_type.is_typed_array_element_type and raw_type: |
184 return base_idl_type + '*' | 188 return base_idl_type + '*' |
185 if idl_type.is_interface_type: | 189 if idl_type.is_interface_type: |
186 implemented_as_class = idl_type.implemented_as | 190 implemented_as_class = idl_type.implemented_as |
187 if raw_type: | 191 if raw_type: |
188 return implemented_as_class + '*' | 192 return implemented_as_class + '*' |
189 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' | 193 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' |
190 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) | 194 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) |
191 return cpp_template_type(ptr_type, implemented_as_class) | 195 return cpp_template_type(ptr_type, implemented_as_class) |
192 # Default, assume native type is a pointer with same type name as idl type | 196 # Default, assume native type is a pointer with same type name as idl type |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 819 |
816 | 820 |
817 def is_explicit_nullable(idl_type): | 821 def is_explicit_nullable(idl_type): |
818 # Nullable type that isn't implicit nullable (see above.) For such types, | 822 # Nullable type that isn't implicit nullable (see above.) For such types, |
819 # we use Nullable<T> or similar explicit ways to represent a null value. | 823 # we use Nullable<T> or similar explicit ways to represent a null value. |
820 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 824 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
821 | 825 |
822 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 826 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) |
823 IdlUnionType.is_implicit_nullable = False | 827 IdlUnionType.is_implicit_nullable = False |
824 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 828 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
OLD | NEW |