Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_methods.py

Issue 1861433002: Make [OriginTrialEnabled] and [RuntimeEnabled] mutually exclusive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@586594-separate-tests
Patch Set: Correct IDL for Web Bluetooth Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 is_post_message = 'PostMessage' in extended_attributes 110 is_post_message = 'PostMessage' in extended_attributes
111 if is_post_message: 111 if is_post_message:
112 includes.add('bindings/core/v8/SerializedScriptValueFactory.h') 112 includes.add('bindings/core/v8/SerializedScriptValueFactory.h')
113 includes.add('core/dom/DOMArrayBuffer.h') 113 includes.add('core/dom/DOMArrayBuffer.h')
114 includes.add('core/dom/MessagePort.h') 114 includes.add('core/dom/MessagePort.h')
115 includes.add('core/frame/ImageBitmap.h') 115 includes.add('core/frame/ImageBitmap.h')
116 116
117 if 'LenientThis' in extended_attributes: 117 if 'LenientThis' in extended_attributes:
118 raise Exception('[LenientThis] is not supported for operations.') 118 raise Exception('[LenientThis] is not supported for operations.')
119 119
120 if 'RuntimeEnabled' in extended_attributes:
121 includes.add('platform/RuntimeEnabledFeatures.h')
122
123 if 'OriginTrialEnabled' in extended_attributes:
124 includes.add('core/inspector/ConsoleMessage.h')
125 includes.add('core/origin_trials/OriginTrials.h')
126
127 argument_contexts = [ 120 argument_contexts = [
128 argument_context(interface, method, argument, index, is_visible=is_visib le) 121 argument_context(interface, method, argument, index, is_visible=is_visib le)
129 for index, argument in enumerate(arguments)] 122 for index, argument in enumerate(arguments)]
130 123
131 return { 124 return {
132 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] 125 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging]
133 'arguments': argument_contexts, 126 'arguments': argument_contexts,
134 'argument_declarations_for_private_script': 127 'argument_declarations_for_private_script':
135 argument_declarations_for_private_script(interface, method), 128 argument_declarations_for_private_script(interface, method),
136 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) 129 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type)
(...skipping 13 matching lines...) Expand all
150 'has_exception_state': 143 'has_exception_state':
151 is_raises_exception or 144 is_raises_exception or
152 is_check_security_for_receiver or 145 is_check_security_for_receiver or
153 any(argument for argument in arguments 146 any(argument for argument in arguments
154 if (argument.idl_type.name == 'SerializedScriptValue' or 147 if (argument.idl_type.name == 'SerializedScriptValue' or
155 argument_conversion_needs_exception_state(method, argument)) ), 148 argument_conversion_needs_exception_state(method, argument)) ),
156 'has_optional_argument_without_default_value': 149 'has_optional_argument_without_default_value':
157 any(True for argument_context in argument_contexts 150 any(True for argument_context in argument_contexts
158 if argument_context['is_optional_without_default_value']), 151 if argument_context['is_optional_without_default_value']),
159 'idl_type': idl_type.base_type, 152 'idl_type': idl_type.base_type,
160 'is_origin_trial_enabled': v8_utilities.origin_trial_enabled_function(me thod) or v8_utilities.origin_trial_enabled_function(interface), # [OriginTrialE nabled]
161 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 153 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
162 'is_call_with_script_arguments': is_call_with_script_arguments, 154 'is_call_with_script_arguments': is_call_with_script_arguments,
163 'is_call_with_script_state': is_call_with_script_state, 155 'is_call_with_script_state': is_call_with_script_state,
164 'is_call_with_this_value': is_call_with_this_value, 156 'is_call_with_this_value': is_call_with_this_value,
165 'is_check_security_for_receiver': is_check_security_for_receiver, 157 'is_check_security_for_receiver': is_check_security_for_receiver,
166 'is_check_security_for_return_value': is_check_security_for_return_value , 158 'is_check_security_for_return_value': is_check_security_for_return_value ,
167 'is_custom': 'Custom' in extended_attributes and 159 'is_custom': 'Custom' in extended_attributes and
168 not (is_custom_call_prologue or is_custom_call_epilogue), 160 not (is_custom_call_prologue or is_custom_call_epilogue),
169 'is_custom_call_prologue': is_custom_call_prologue, 161 'is_custom_call_prologue': is_custom_call_prologue,
170 'is_custom_call_epilogue': is_custom_call_epilogue, 162 'is_custom_call_epilogue': is_custom_call_epilogue,
(...skipping 15 matching lines...) Expand all
186 'number_of_required_arguments': len([ 178 'number_of_required_arguments': len([
187 argument for argument in arguments 179 argument for argument in arguments
188 if not (argument.is_optional or argument.is_variadic)]), 180 if not (argument.is_optional or argument.is_variadic)]),
189 'number_of_required_or_variadic_arguments': len([ 181 'number_of_required_or_variadic_arguments': len([
190 argument for argument in arguments 182 argument for argument in arguments
191 if not argument.is_optional]), 183 if not argument.is_optional]),
192 'on_instance': v8_utilities.on_instance(interface, method), 184 'on_instance': v8_utilities.on_instance(interface, method),
193 'on_interface': v8_utilities.on_interface(interface, method), 185 'on_interface': v8_utilities.on_interface(interface, method),
194 'on_prototype': v8_utilities.on_prototype(interface, method), 186 'on_prototype': v8_utilities.on_prototype(interface, method),
195 'only_exposed_to_private_script': is_only_exposed_to_private_script, 187 'only_exposed_to_private_script': is_only_exposed_to_private_script,
196 'origin_trial_enabled': v8_utilities.origin_trial_enabled_function(metho d), # [OriginTrialEnabled] 188 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(method, interface), # [OriginTrialEnabled]
197 'origin_trial_enabled_per_interface': v8_utilities.origin_trial_enabled_ function(interface), # [OriginTrialEnabled]
198 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 189 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
199 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'), 190 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'),
200 'property_attributes': property_attributes(interface, method), 191 'property_attributes': property_attributes(interface, method),
201 'returns_promise': method.returns_promise, 192 'returns_promise': method.returns_promise,
202 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] 193 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled]
203 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 194 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
204 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult, 195 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult,
205 'use_local_result': use_local_result(method), 196 'use_local_result': use_local_result(method),
206 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 197 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
207 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 198 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 return method.idl_type and method.idl_type.name == 'Promise' 471 return method.idl_type and method.idl_type.name == 'Promise'
481 472
482 IdlOperation.returns_promise = property(method_returns_promise) 473 IdlOperation.returns_promise = property(method_returns_promise)
483 474
484 475
485 def argument_conversion_needs_exception_state(method, argument): 476 def argument_conversion_needs_exception_state(method, argument):
486 idl_type = argument.idl_type 477 idl_type = argument.idl_type
487 return (idl_type.v8_conversion_needs_exception_state or 478 return (idl_type.v8_conversion_needs_exception_state or
488 argument.is_variadic or 479 argument.is_variadic or
489 (method.returns_promise and idl_type.is_string_type)) 480 (method.returns_promise and idl_type.is_string_type))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698