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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 is_post_message = 'PostMessage' in extended_attributes | 113 is_post_message = 'PostMessage' in extended_attributes |
| 114 if is_post_message: | 114 if is_post_message: |
| 115 includes.add('bindings/core/v8/SerializedScriptValueFactory.h') | 115 includes.add('bindings/core/v8/SerializedScriptValueFactory.h') |
| 116 includes.add('core/dom/DOMArrayBuffer.h') | 116 includes.add('core/dom/DOMArrayBuffer.h') |
| 117 includes.add('core/dom/MessagePort.h') | 117 includes.add('core/dom/MessagePort.h') |
| 118 includes.add('core/frame/ImageBitmap.h') | 118 includes.add('core/frame/ImageBitmap.h') |
| 119 | 119 |
| 120 if 'LenientThis' in extended_attributes: | 120 if 'LenientThis' in extended_attributes: |
| 121 raise Exception('[LenientThis] is not supported for operations.') | 121 raise Exception('[LenientThis] is not supported for operations.') |
| 122 | 122 |
| 123 argument_contexts = [ | |
| 124 argument_context(interface, method, argument, index, is_visible=is_visib le) | |
| 125 for index, argument in enumerate(arguments)] | |
| 126 | |
| 123 return { | 127 return { |
| 124 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] | 128 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] |
| 125 'arguments': [argument_context(interface, method, argument, index, is_vi sible=is_visible) | 129 'arguments': argument_contexts, |
| 126 for index, argument in enumerate(arguments)], | |
| 127 'argument_declarations_for_private_script': | 130 'argument_declarations_for_private_script': |
| 128 argument_declarations_for_private_script(interface, method), | 131 argument_declarations_for_private_script(interface, method), |
| 129 'conditional_string': v8_utilities.conditional_string(method), | 132 'conditional_string': v8_utilities.conditional_string(method), |
| 130 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) | 133 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) |
| 131 if idl_type.is_explicit_nullable else idl_type.cpp_type), | 134 if idl_type.is_explicit_nullable else idl_type.cpp_type), |
| 132 'cpp_value': this_cpp_value, | 135 'cpp_value': this_cpp_value, |
| 133 'cpp_type_initializer': idl_type.cpp_type_initializer, | 136 'cpp_type_initializer': idl_type.cpp_type_initializer, |
| 134 'custom_registration_extended_attributes': | 137 'custom_registration_extended_attributes': |
| 135 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( | 138 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( |
| 136 extended_attributes.iterkeys()), | 139 extended_attributes.iterkeys()), |
| 137 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] | 140 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] |
| 138 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] | 141 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] |
| 139 # TODO(yukishiino): Retire has_custom_registration flag. Should be | 142 # TODO(yukishiino): Retire has_custom_registration flag. Should be |
| 140 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. | 143 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. |
| 141 'has_custom_registration': | 144 'has_custom_registration': |
| 142 v8_utilities.has_extended_attribute( | 145 v8_utilities.has_extended_attribute( |
| 143 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), | 146 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), |
| 144 'has_exception_state': | 147 'has_exception_state': |
| 145 is_raises_exception or | 148 is_raises_exception or |
| 146 is_check_security_for_frame or | 149 is_check_security_for_frame or |
| 147 is_check_security_for_window or | 150 is_check_security_for_window or |
| 148 any(argument for argument in arguments | 151 any(argument for argument in arguments |
| 149 if (argument.idl_type.name == 'SerializedScriptValue' or | 152 if (argument.idl_type.name == 'SerializedScriptValue' or |
| 150 argument_conversion_needs_exception_state(method, argument)) ), | 153 argument_conversion_needs_exception_state(method, argument)) ), |
| 154 'has_optional_argument_without_default_value': | |
| 155 any(True for argument_context in argument_contexts | |
|
bashi
2015/11/26 23:37:18
Can we have a helper function for |has_optional_ar
Yuki
2015/11/30 06:53:23
Done.
| |
| 156 if (argument_context['is_optional'] and | |
| 157 not argument_context['has_default'] and | |
| 158 not argument_context['is_dictionary'] and | |
| 159 not argument_context['is_callback_interface'])), | |
| 151 'idl_type': idl_type.base_type, | 160 'idl_type': idl_type.base_type, |
| 152 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), | 161 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), |
| 153 'is_call_with_script_arguments': is_call_with_script_arguments, | 162 'is_call_with_script_arguments': is_call_with_script_arguments, |
| 154 'is_call_with_script_state': is_call_with_script_state, | 163 'is_call_with_script_state': is_call_with_script_state, |
| 155 'is_call_with_this_value': is_call_with_this_value, | 164 'is_call_with_this_value': is_call_with_this_value, |
| 156 'is_check_security_for_frame': is_check_security_for_frame, | 165 'is_check_security_for_frame': is_check_security_for_frame, |
| 157 'is_check_security_for_node': is_check_security_for_node, | 166 'is_check_security_for_node': is_check_security_for_node, |
| 158 'is_check_security_for_window': is_check_security_for_window, | 167 'is_check_security_for_window': is_check_security_for_window, |
| 159 'is_custom': 'Custom' in extended_attributes and | 168 'is_custom': 'Custom' in extended_attributes and |
| 160 not (is_custom_call_prologue or is_custom_call_epilogue), | 169 not (is_custom_call_prologue or is_custom_call_epilogue), |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 return method.idl_type and method.idl_type.name == 'Promise' | 472 return method.idl_type and method.idl_type.name == 'Promise' |
| 464 | 473 |
| 465 IdlOperation.returns_promise = property(method_returns_promise) | 474 IdlOperation.returns_promise = property(method_returns_promise) |
| 466 | 475 |
| 467 | 476 |
| 468 def argument_conversion_needs_exception_state(method, argument): | 477 def argument_conversion_needs_exception_state(method, argument): |
| 469 idl_type = argument.idl_type | 478 idl_type = argument.idl_type |
| 470 return (idl_type.v8_conversion_needs_exception_state or | 479 return (idl_type.v8_conversion_needs_exception_state or |
| 471 argument.is_variadic or | 480 argument.is_variadic or |
| 472 (method.returns_promise and idl_type.is_string_type)) | 481 (method.returns_promise and idl_type.is_string_type)) |
| OLD | NEW |