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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 extended_attributes = argument.extended_attributes | 194 extended_attributes = argument.extended_attributes |
195 idl_type = argument.idl_type | 195 idl_type = argument.idl_type |
196 this_cpp_value = cpp_value(interface, method, index) | 196 this_cpp_value = cpp_value(interface, method, index) |
197 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 197 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
198 | 198 |
199 type_checking_interface = ( | 199 type_checking_interface = ( |
200 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or | 200 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or |
201 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and | 201 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and |
202 idl_type.is_wrapper_type) | 202 idl_type.is_wrapper_type) |
203 | 203 |
204 restricted_float = ( | |
205 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or | |
206 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) | |
207 | |
208 if ('ImplementedInPrivateScript' in extended_attributes and | 204 if ('ImplementedInPrivateScript' in extended_attributes and |
209 not idl_type.is_wrapper_type and | 205 not idl_type.is_wrapper_type and |
210 not idl_type.is_basic_type): | 206 not idl_type.is_basic_type): |
211 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') | 207 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') |
212 | 208 |
213 set_default_value = argument.set_default_value | 209 set_default_value = argument.set_default_value |
214 return { | 210 return { |
215 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut
es, | 211 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut
es, |
216 raw_type=True, | 212 raw_type=True, |
217 used_as_variadic_argument=argument.is
_variadic), | 213 used_as_variadic_argument=argument.is
_variadic), |
(...skipping 18 matching lines...) Expand all Loading... |
236 'is_variadic': argument.is_variadic, | 232 'is_variadic': argument.is_variadic, |
237 'is_variadic_wrapper_type': is_variadic_wrapper_type, | 233 'is_variadic_wrapper_type': is_variadic_wrapper_type, |
238 'is_wrapper_type': idl_type.is_wrapper_type, | 234 'is_wrapper_type': idl_type.is_wrapper_type, |
239 'name': argument.name, | 235 'name': argument.name, |
240 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 236 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
241 argument.name, isolate='scriptState->isolate()', | 237 argument.name, isolate='scriptState->isolate()', |
242 creation_context='scriptState->context()->Global()'), | 238 creation_context='scriptState->context()->Global()'), |
243 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, | 239 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, |
244 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 240 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
245 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 241 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
246 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(method, argum
ent, index, restricted_float=restricted_float), | 242 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(method, argum
ent, index), |
247 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc
_type), | 243 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc
_type), |
248 } | 244 } |
249 | 245 |
250 | 246 |
251 def argument_declarations_for_private_script(interface, method): | 247 def argument_declarations_for_private_script(interface, method): |
252 argument_declarations = ['LocalFrame* frame'] | 248 argument_declarations = ['LocalFrame* frame'] |
253 argument_declarations.append('%s* holderImpl' % interface.name) | 249 argument_declarations.append('%s* holderImpl' % interface.name) |
254 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( | 250 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( |
255 used_as_rvalue_type=True), argument.name) for argument in method.argumen
ts]) | 251 used_as_rvalue_type=True), argument.name) for argument in method.argumen
ts]) |
256 if method.idl_type.name != 'void': | 252 if method.idl_type.name != 'void': |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 442 |
447 IdlOperation.returns_promise = property(method_returns_promise) | 443 IdlOperation.returns_promise = property(method_returns_promise) |
448 | 444 |
449 | 445 |
450 def argument_conversion_needs_exception_state(method, argument): | 446 def argument_conversion_needs_exception_state(method, argument): |
451 idl_type = argument.idl_type | 447 idl_type = argument.idl_type |
452 return (idl_type.v8_conversion_needs_exception_state or | 448 return (idl_type.v8_conversion_needs_exception_state or |
453 argument.is_variadic or | 449 argument.is_variadic or |
454 (method.returns_promise and (idl_type.is_string_type or | 450 (method.returns_promise and (idl_type.is_string_type or |
455 idl_type.is_enum))) | 451 idl_type.is_enum))) |
OLD | NEW |