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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 'DoNotCheckSecurity' not in extended_attributes) | 79 'DoNotCheckSecurity' not in extended_attributes) |
80 is_raises_exception = 'RaisesException' in extended_attributes | 80 is_raises_exception = 'RaisesException' in extended_attributes |
81 | 81 |
82 if idl_type.union_arguments and len(idl_type.union_arguments) > 0: | 82 if idl_type.union_arguments and len(idl_type.union_arguments) > 0: |
83 this_cpp_type = [] | 83 this_cpp_type = [] |
84 for cpp_type in idl_type.member_types: | 84 for cpp_type in idl_type.member_types: |
85 this_cpp_type.append("RefPtr<%s>" % cpp_type) | 85 this_cpp_type.append("RefPtr<%s>" % cpp_type) |
86 else: | 86 else: |
87 this_cpp_type = idl_type.cpp_type | 87 this_cpp_type = idl_type.cpp_type |
88 | 88 |
89 is_auto_scope = dart_types.is_auto_scope_callback(interface.name, name) | 89 is_auto_scope = not 'DartNoAutoScope' in extended_attributes |
90 method_data = { | 90 method_data = { |
91 'activity_logging_world_list': dart_utilities.activity_logging_world_lis
t(method), # [ActivityLogging] | 91 'activity_logging_world_list': dart_utilities.activity_logging_world_lis
t(method), # [ActivityLogging] |
92 'arguments': [generate_argument(interface, method, argument, index) | 92 'arguments': [generate_argument(interface, method, argument, index) |
93 for index, argument in enumerate(arguments)], | 93 for index, argument in enumerate(arguments)], |
94 'conditional_string': dart_utilities.conditional_string(method), | 94 'conditional_string': dart_utilities.conditional_string(method), |
95 'cpp_type': this_cpp_type, | 95 'cpp_type': this_cpp_type, |
96 'cpp_value': this_cpp_value, | 96 'cpp_value': this_cpp_value, |
97 'dart_name': extended_attributes.get('DartName'), | 97 'dart_name': extended_attributes.get('DartName'), |
98 'deprecate_as': dart_utilities.deprecate_as(method), # [DeprecateAs] | 98 'deprecate_as': dart_utilities.deprecate_as(method), # [DeprecateAs] |
99 'do_not_check_signature': not(is_static or | 99 'do_not_check_signature': not(is_static or |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 return method_data | 154 return method_data |
155 | 155 |
156 | 156 |
157 def generate_argument(interface, method, argument, index): | 157 def generate_argument(interface, method, argument, index): |
158 extended_attributes = argument.extended_attributes | 158 extended_attributes = argument.extended_attributes |
159 idl_type = argument.idl_type | 159 idl_type = argument.idl_type |
160 this_cpp_value = cpp_value(interface, method, index) | 160 this_cpp_value = cpp_value(interface, method, index) |
161 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 161 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
162 use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garb
age_collected | 162 use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garb
age_collected |
163 auto_scope = dart_types.is_auto_scope_callback(interface.name, method.name) | 163 auto_scope = not 'DartNoAutoScope' in extended_attributes |
164 this_has_default = 'Default' in extended_attributes | 164 this_has_default = 'Default' in extended_attributes |
165 arg_index = index + 1 if not method.is_static else index | 165 arg_index = index + 1 if not method.is_static else index |
166 | 166 |
167 argument_data = { | 167 argument_data = { |
168 'cpp_type': idl_type.cpp_type_args(will_be_in_heap_object=use_heap_vecto
r_type), | 168 'cpp_type': idl_type.cpp_type_args(will_be_in_heap_object=use_heap_vecto
r_type), |
169 'cpp_value': this_cpp_value, | 169 'cpp_value': this_cpp_value, |
170 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, u
sed_as_argument=True), | 170 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, u
sed_as_argument=True), |
171 'enum_validation_expression': idl_type.enum_validation_expression, | 171 'enum_validation_expression': idl_type.enum_validation_expression, |
172 # Ignore 'Default' in extended_attributes not exposed in dart:html. | 172 # Ignore 'Default' in extended_attributes not exposed in dart:html. |
173 'has_default': False, | 173 'has_default': False, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 release = idl_type.release | 256 release = idl_type.release |
257 | 257 |
258 # [CallWith=ScriptState], [RaisesException] | 258 # [CallWith=ScriptState], [RaisesException] |
259 # TODO(terry): Disable ScriptState temporarily need to handle. | 259 # TODO(terry): Disable ScriptState temporarily need to handle. |
260 # if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 260 # if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
261 # 'RaisesException' in extended_attributes or | 261 # 'RaisesException' in extended_attributes or |
262 # idl_type.is_union_type): | 262 # idl_type.is_union_type): |
263 # cpp_value = 'result' # use local variable for value | 263 # cpp_value = 'result' # use local variable for value |
264 # release = idl_type.release | 264 # release = idl_type.release |
265 | 265 |
266 auto_scope = dart_types.is_auto_scope_callback(interface_name, method.name), | 266 auto_scope = not 'DartNoAutoScope' in extended_attributes |
267 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' | 267 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else
'' |
268 return idl_type.dart_set_return_value(cpp_value, extended_attributes, | 268 return idl_type.dart_set_return_value(cpp_value, extended_attributes, |
269 script_wrappable=script_wrappable, | 269 script_wrappable=script_wrappable, |
270 release=release, | 270 release=release, |
271 for_main_world=for_main_world, | 271 for_main_world=for_main_world, |
272 auto_scope=auto_scope) | 272 auto_scope=auto_scope) |
273 | 273 |
274 | 274 |
275 def dart_value_to_local_cpp_value(argument, index, auto_scope=True): | 275 def dart_value_to_local_cpp_value(argument, index, auto_scope=True): |
276 extended_attributes = argument.extended_attributes | 276 extended_attributes = argument.extended_attributes |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 | 310 |
311 def union_arguments(idl_type): | 311 def union_arguments(idl_type): |
312 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 312 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
313 return [arg | 313 return [arg |
314 for i in range(len(idl_type.member_types)) | 314 for i in range(len(idl_type.member_types)) |
315 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 315 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
316 | 316 |
317 IdlType.union_arguments = property(lambda self: None) | 317 IdlType.union_arguments = property(lambda self: None) |
318 IdlUnionType.union_arguments = property(union_arguments) | 318 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |