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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 | 62 |
63 def custom_registration(method): | 63 def custom_registration(method): |
64 # TODO(dcheng): Currently, bindings must create a function object for each | 64 # TODO(dcheng): Currently, bindings must create a function object for each |
65 # realm as a hack to support the incumbent realm. Remove the need for custom | 65 # realm as a hack to support the incumbent realm. Remove the need for custom |
66 # registration when Blink properly supports the incumbent realm. | 66 # registration when Blink properly supports the incumbent realm. |
67 if method['is_cross_origin']: | 67 if method['is_cross_origin']: |
68 return True | 68 return True |
69 if 'overloads' in method: | 69 if 'overloads' in method: |
70 return (method['overloads']['runtime_determined_lengths'] or | 70 return (method['overloads']['runtime_determined_lengths'] or |
71 (method['overloads']['runtime_enabled_function_all'] and not con
ditionally_exposed(method))) | 71 (method['overloads']['runtime_enabled_all'] and not conditionall
y_exposed(method))) |
72 return method['runtime_enabled_function'] and not conditionally_exposed(meth
od) | 72 return method['runtime_enabled_feature_name'] and not conditionally_exposed(
method) |
73 | 73 |
74 | 74 |
75 def filter_custom_registration(methods, interface_is_partial): | 75 def filter_custom_registration(methods, interface_is_partial): |
76 return [method for method in methods if ( | 76 return [method for method in methods if ( |
77 method_is_visible(method, interface_is_partial) and custom_registration(
method))] | 77 method_is_visible(method, interface_is_partial) and custom_registration(
method))] |
78 | 78 |
79 | 79 |
80 def filter_method_configuration(methods, interface_is_partial): | 80 def filter_method_configuration(methods, interface_is_partial): |
81 return [method for method in methods if | 81 return [method for method in methods if |
82 method_is_visible(method, interface_is_partial) and | 82 method_is_visible(method, interface_is_partial) and |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 'number_of_required_or_variadic_arguments': len([ | 208 'number_of_required_or_variadic_arguments': len([ |
209 argument for argument in arguments | 209 argument for argument in arguments |
210 if not argument.is_optional]), | 210 if not argument.is_optional]), |
211 'on_instance': v8_utilities.on_instance(interface, method), | 211 'on_instance': v8_utilities.on_instance(interface, method), |
212 'on_interface': v8_utilities.on_interface(interface, method), | 212 'on_interface': v8_utilities.on_interface(interface, method), |
213 'on_prototype': v8_utilities.on_prototype(interface, method), | 213 'on_prototype': v8_utilities.on_prototype(interface, method), |
214 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(method), # [OriginTrialEnabled] | 214 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(method), # [OriginTrialEnabled] |
215 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth
od), # [OriginTrialEnabled] | 215 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth
od), # [OriginTrialEnabled] |
216 'property_attributes': property_attributes(interface, method), | 216 'property_attributes': property_attributes(interface, method), |
217 'returns_promise': method.returns_promise, | 217 'returns_promise': method.returns_promise, |
218 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m
ethod), # [RuntimeEnabled] | 218 'runtime_enabled_feature_name': v8_utilities.runtime_enabled_feature_nam
e(method), # [RuntimeEnabled] |
219 'secure_context_test': v8_utilities.secure_context(method, interface),
# [SecureContext] | 219 'secure_context_test': v8_utilities.secure_context(method, interface),
# [SecureContext] |
220 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, | 220 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, |
221 'use_local_result': use_local_result(method), | 221 'use_local_result': use_local_result(method), |
222 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 222 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
223 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 223 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
224 'visible': is_visible, | 224 'visible': is_visible, |
225 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], | 225 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], |
226 } | 226 } |
227 | 227 |
228 | 228 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return method.idl_type and method.idl_type.name == 'Promise' | 447 return method.idl_type and method.idl_type.name == 'Promise' |
448 | 448 |
449 IdlOperation.returns_promise = property(method_returns_promise) | 449 IdlOperation.returns_promise = property(method_returns_promise) |
450 | 450 |
451 | 451 |
452 def argument_conversion_needs_exception_state(method, argument): | 452 def argument_conversion_needs_exception_state(method, argument): |
453 idl_type = argument.idl_type | 453 idl_type = argument.idl_type |
454 return (idl_type.v8_conversion_needs_exception_state or | 454 return (idl_type.v8_conversion_needs_exception_state or |
455 argument.is_variadic or | 455 argument.is_variadic or |
456 (method.returns_promise and idl_type.is_string_type)) | 456 (method.returns_promise and idl_type.is_string_type)) |
OLD | NEW |