| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 IdlType.is_will_be_garbage_collected = property( | 304 IdlType.is_will_be_garbage_collected = property( |
| 305 lambda self: self.base_type in IdlType.will_be_garbage_collected_types) | 305 lambda self: self.base_type in IdlType.will_be_garbage_collected_types) |
| 306 | 306 |
| 307 IdlType.set_will_be_garbage_collected_types = classmethod( | 307 IdlType.set_will_be_garbage_collected_types = classmethod( |
| 308 lambda cls, new_will_be_garbage_collected_types: | 308 lambda cls, new_will_be_garbage_collected_types: |
| 309 cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected
_types)) | 309 cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected
_types)) |
| 310 | 310 |
| 311 | 311 |
| 312 def gc_type(idl_type): | 312 def gc_type(idl_type): |
| 313 if idl_type.is_garbage_collected: | 313 if idl_type.is_garbage_collected or idl_type.is_dictionary: |
| 314 return 'GarbageCollectedObject' | 314 return 'GarbageCollectedObject' |
| 315 if idl_type.is_will_be_garbage_collected: | 315 if idl_type.is_will_be_garbage_collected: |
| 316 return 'WillBeGarbageCollectedObject' | 316 return 'WillBeGarbageCollectedObject' |
| 317 return 'RefCountedObject' | 317 return 'RefCountedObject' |
| 318 | 318 |
| 319 IdlTypeBase.gc_type = property(gc_type) | 319 IdlTypeBase.gc_type = property(gc_type) |
| 320 | 320 |
| 321 | 321 |
| 322 def is_traceable(idl_type): | 322 def is_traceable(idl_type): |
| 323 return (idl_type.is_garbage_collected | 323 return (idl_type.is_garbage_collected |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 # and is used to provide a human-readable exception message | 583 # and is used to provide a human-readable exception message |
| 584 if index is None: | 584 if index is None: |
| 585 index = 0 # special case, meaning "setter" | 585 index = 0 # special case, meaning "setter" |
| 586 else: | 586 else: |
| 587 index += 1 # human-readable index | 587 index += 1 # human-readable index |
| 588 if (native_array_element_type.is_interface_type and | 588 if (native_array_element_type.is_interface_type and |
| 589 native_array_element_type.name != 'Dictionary'): | 589 native_array_element_type.name != 'Dictionary'): |
| 590 this_cpp_type = None | 590 this_cpp_type = None |
| 591 ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_typ
e.gc_type) | 591 ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_typ
e.gc_type) |
| 592 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_
type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS
tate))' | 592 expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_
type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionS
tate))' |
| 593 elif native_array_element_type.is_dictionary: |
| 594 ref_ptr_type = None |
| 595 this_cpp_type = native_array_element_type.cpp_type |
| 596 expression_format = 'toImplHeapArray<{cpp_type}>({v8_value}, {index}, {i
solate}, exceptionState)' |
| 593 else: | 597 else: |
| 594 ref_ptr_type = None | 598 ref_ptr_type = None |
| 595 this_cpp_type = native_array_element_type.cpp_type | 599 this_cpp_type = native_array_element_type.cpp_type |
| 596 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola
te}, exceptionState)' | 600 expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isola
te}, exceptionState)' |
| 597 expression = expression_format.format(native_array_element_type=native_array
_element_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_ty
pe, v8_value=v8_value, isolate=isolate) | 601 expression = expression_format.format(native_array_element_type=native_array
_element_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_ty
pe, v8_value=v8_value, isolate=isolate) |
| 598 return expression | 602 return expression |
| 599 | 603 |
| 600 | 604 |
| 601 # FIXME: this function should be refactored, as this takes too many flags. | 605 # FIXME: this function should be refactored, as this takes too many flags. |
| 602 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name, index=None, declare_variable=True, isolate='info.GetIsolate()', bailout_
return_value=None, use_exception_state=False, restricted_float=False): | 606 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
e_name, index=None, declare_variable=True, isolate='info.GetIsolate()', bailout_
return_value=None, use_exception_state=False, restricted_float=False): |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 number_of_nullable_member_types_union) | 978 number_of_nullable_member_types_union) |
| 975 | 979 |
| 976 | 980 |
| 977 def includes_nullable_type_union(idl_type): | 981 def includes_nullable_type_union(idl_type): |
| 978 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 982 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 979 return idl_type.number_of_nullable_member_types == 1 | 983 return idl_type.number_of_nullable_member_types == 1 |
| 980 | 984 |
| 981 IdlTypeBase.includes_nullable_type = False | 985 IdlTypeBase.includes_nullable_type = False |
| 982 IdlNullableType.includes_nullable_type = True | 986 IdlNullableType.includes_nullable_type = True |
| 983 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 987 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |