| 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'] 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 'number_of_required_or_variadic_arguments': len([ | 218 'number_of_required_or_variadic_arguments': len([ |
| 219 argument for argument in arguments | 219 argument for argument in arguments |
| 220 if not argument.is_optional]), | 220 if not argument.is_optional]), |
| 221 'on_instance': v8_utilities.on_instance(interface, method), | 221 'on_instance': v8_utilities.on_instance(interface, method), |
| 222 'on_interface': v8_utilities.on_interface(interface, method), | 222 'on_interface': v8_utilities.on_interface(interface, method), |
| 223 'on_prototype': v8_utilities.on_prototype(interface, method), | 223 'on_prototype': v8_utilities.on_prototype(interface, method), |
| 224 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(method), # [OriginTrialEnabled] | 224 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct
ion_name(method), # [OriginTrialEnabled] |
| 225 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth
od), # [OriginTrialEnabled] | 225 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth
od), # [OriginTrialEnabled] |
| 226 'property_attributes': property_attributes(interface, method), | 226 'property_attributes': property_attributes(interface, method), |
| 227 'returns_promise': method.returns_promise, | 227 'returns_promise': method.returns_promise, |
| 228 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m
ethod), # [RuntimeEnabled] | 228 'runtime_enabled': v8_utilities.runtime_feature_name(method), # [Runtim
eEnabled] |
| 229 'secure_context_test': v8_utilities.secure_context(method, interface),
# [SecureContext] | 229 'secure_context_test': v8_utilities.secure_context(method, interface),
# [SecureContext] |
| 230 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, | 230 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, |
| 231 'use_local_result': use_local_result(method), | 231 'use_local_result': use_local_result(method), |
| 232 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 232 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
| 233 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 233 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
| 234 'visible': is_visible, | 234 'visible': is_visible, |
| 235 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], | 235 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 return method.idl_type and method.idl_type.name == 'Promise' | 457 return method.idl_type and method.idl_type.name == 'Promise' |
| 458 | 458 |
| 459 IdlOperation.returns_promise = property(method_returns_promise) | 459 IdlOperation.returns_promise = property(method_returns_promise) |
| 460 | 460 |
| 461 | 461 |
| 462 def argument_conversion_needs_exception_state(method, argument): | 462 def argument_conversion_needs_exception_state(method, argument): |
| 463 idl_type = argument.idl_type | 463 idl_type = argument.idl_type |
| 464 return (idl_type.v8_conversion_needs_exception_state or | 464 return (idl_type.v8_conversion_needs_exception_state or |
| 465 argument.is_variadic or | 465 argument.is_variadic or |
| 466 (method.returns_promise and idl_type.is_string_type)) | 466 (method.returns_promise and idl_type.is_string_type)) |
| OLD | NEW |