Chromium Code Reviews| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 if (native_array_element_type.is_interface_type and | 632 if (native_array_element_type.is_interface_type and |
| 633 native_array_element_type.name != 'Dictionary'): | 633 native_array_element_type.name != 'Dictionary'): |
| 634 this_cpp_type = None | 634 this_cpp_type = None |
| 635 expression_format = 'toMemberNativeArray<{native_array_element_type}>({v 8_value}, {index}, {isolate}, exceptionState)' | 635 expression_format = 'toMemberNativeArray<{native_array_element_type}>({v 8_value}, {index}, {isolate}, exceptionState)' |
| 636 else: | 636 else: |
| 637 this_cpp_type = native_array_element_type.cpp_type | 637 this_cpp_type = native_array_element_type.cpp_type |
| 638 if native_array_element_type.is_dictionary or native_array_element_type. is_union_type: | 638 if native_array_element_type.is_dictionary or native_array_element_type. is_union_type: |
| 639 vector_type = 'HeapVector' | 639 vector_type = 'HeapVector' |
| 640 else: | 640 else: |
| 641 vector_type = 'Vector' | 641 vector_type = 'Vector' |
| 642 expression_format = 'toImplArray<%s<{cpp_type}>>({v8_value}, {index}, {i solate}, exceptionState)' % vector_type | 642 if native_array_element_type.is_primitive_type: |
|
haraken
2017/04/03 04:29:02
Why do we need to limit this to primitive types?
bashi
2017/04/03 04:42:34
Just to minimize the impact of changes to see if t
bashi
2017/04/03 05:06:25
Looks like we need to improve coverage of native_v
Raphael Kubo da Costa (rakuco)
2017/04/06 13:22:36
(belatedly adding myself to the party)
Are you ac
| |
| 643 value_type = native_value_traits_type_name(native_array_element_type ) | |
| 644 expression_format = ('toImplArray<%s<{cpp_type}>, %s>' | |
| 645 '({v8_value}, {index}, {isolate}, ' | |
| 646 'exceptionState)' % (vector_type, value_type)) | |
| 647 else: | |
| 648 expression_format = ('toImplArray<%s<{cpp_type}>>' | |
| 649 '({v8_value}, {index}, {isolate}, ' | |
| 650 'exceptionState)' % vector_type) | |
| 651 | |
| 643 expression = expression_format.format(native_array_element_type=native_array _element_type.name, cpp_type=this_cpp_type, | 652 expression = expression_format.format(native_array_element_type=native_array _element_type.name, cpp_type=this_cpp_type, |
| 644 index=index, v8_value=v8_value, isolat e=isolate) | 653 index=index, v8_value=v8_value, isolat e=isolate) |
| 645 return expression | 654 return expression |
| 646 | 655 |
| 647 | 656 |
| 648 # FIXME: this function should be refactored, as this takes too many flags. | 657 # FIXME: this function should be refactored, as this takes too many flags. |
| 649 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl e_name, index=None, declare_variable=True, | 658 def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl e_name, index=None, declare_variable=True, |
| 650 isolate='info.GetIsolate()', bailout_return_valu e=None, use_exception_state=False): | 659 isolate='info.GetIsolate()', bailout_return_valu e=None, use_exception_state=False): |
| 651 """Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" | 660 """Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" |
| 652 | 661 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1059 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 1068 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
| 1060 | 1069 |
| 1061 | 1070 |
| 1062 def includes_nullable_type_union(idl_type): | 1071 def includes_nullable_type_union(idl_type): |
| 1063 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 1072 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
| 1064 return idl_type.number_of_nullable_member_types == 1 | 1073 return idl_type.number_of_nullable_member_types == 1 |
| 1065 | 1074 |
| 1066 IdlTypeBase.includes_nullable_type = False | 1075 IdlTypeBase.includes_nullable_type = False |
| 1067 IdlNullableType.includes_nullable_type = True | 1076 IdlNullableType.includes_nullable_type = True |
| 1068 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 1077 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
| OLD | NEW |