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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 4 years, 11 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 includes.add('core/dom/MessagePort.h') 115 includes.add('core/dom/MessagePort.h')
116 includes.add('core/frame/ImageBitmap.h') 116 includes.add('core/frame/ImageBitmap.h')
117 117
118 conditional_string = v8_utilities.conditional_string(method) 118 conditional_string = v8_utilities.conditional_string(method)
119 if conditional_string: 119 if conditional_string:
120 includes.add('wtf/build_config.h') 120 includes.add('wtf/build_config.h')
121 121
122 if 'LenientThis' in extended_attributes: 122 if 'LenientThis' in extended_attributes:
123 raise Exception('[LenientThis] is not supported for operations.') 123 raise Exception('[LenientThis] is not supported for operations.')
124 124
125 if 'APIExperimentEnabled' in extended_attributes:
126 includes.add('core/experiments/ExperimentalFeatures.h')
127 includes.add('core/inspector/ConsoleMessage.h')
128
125 argument_contexts = [ 129 argument_contexts = [
126 argument_context(interface, method, argument, index, is_visible=is_visib le) 130 argument_context(interface, method, argument, index, is_visible=is_visib le)
127 for index, argument in enumerate(arguments)] 131 for index, argument in enumerate(arguments)]
128 132
129 return { 133 return {
130 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] 134 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging]
135 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(m ethod), # [APIExperimentEnabled]
136 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab led_function(interface), # [APIExperimentEnabled]
131 'arguments': argument_contexts, 137 'arguments': argument_contexts,
132 'argument_declarations_for_private_script': 138 'argument_declarations_for_private_script':
133 argument_declarations_for_private_script(interface, method), 139 argument_declarations_for_private_script(interface, method),
134 'conditional_string': conditional_string, 140 'conditional_string': conditional_string,
135 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) 141 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type)
136 if idl_type.is_explicit_nullable else idl_type.cpp_type), 142 if idl_type.is_explicit_nullable else idl_type.cpp_type),
137 'cpp_value': this_cpp_value, 143 'cpp_value': this_cpp_value,
138 'cpp_type_initializer': idl_type.cpp_type_initializer, 144 'cpp_type_initializer': idl_type.cpp_type_initializer,
139 'custom_registration_extended_attributes': 145 'custom_registration_extended_attributes':
140 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( 146 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection(
141 extended_attributes.iterkeys()), 147 extended_attributes.iterkeys()),
142 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] 148 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
143 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] 149 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed]
144 # TODO(yukishiino): Retire has_custom_registration flag. Should be 150 # TODO(yukishiino): Retire has_custom_registration flag. Should be
145 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. 151 # replaced with V8DOMConfiguration::PropertyLocationConfiguration.
146 'has_custom_registration': 152 'has_custom_registration':
147 v8_utilities.has_extended_attribute( 153 v8_utilities.has_extended_attribute(
148 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), 154 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
149 'has_exception_state': 155 'has_exception_state':
150 is_raises_exception or 156 is_raises_exception or
151 is_check_security_for_receiver or 157 is_check_security_for_receiver or
152 any(argument for argument in arguments 158 any(argument for argument in arguments
153 if (argument.idl_type.name == 'SerializedScriptValue' or 159 if (argument.idl_type.name == 'SerializedScriptValue' or
154 argument_conversion_needs_exception_state(method, argument)) ), 160 argument_conversion_needs_exception_state(method, argument)) ),
155 'has_optional_argument_without_default_value': 161 'has_optional_argument_without_default_value':
156 any(True for argument_context in argument_contexts 162 any(True for argument_context in argument_contexts
157 if argument_context['is_optional_without_default_value']), 163 if argument_context['is_optional_without_default_value']),
158 'idl_type': idl_type.base_type, 164 'idl_type': idl_type.base_type,
165 'is_api_experiment_enabled': v8_utilities.api_experiment_enabled_functio n(method) or v8_utilities.api_experiment_enabled_function(interface), # [APIExp erimentEnabled]
159 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), 166 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'),
160 'is_call_with_script_arguments': is_call_with_script_arguments, 167 'is_call_with_script_arguments': is_call_with_script_arguments,
161 'is_call_with_script_state': is_call_with_script_state, 168 'is_call_with_script_state': is_call_with_script_state,
162 'is_call_with_this_value': is_call_with_this_value, 169 'is_call_with_this_value': is_call_with_this_value,
163 'is_check_security_for_receiver': is_check_security_for_receiver, 170 'is_check_security_for_receiver': is_check_security_for_receiver,
164 'is_check_security_for_return_value': is_check_security_for_return_value , 171 'is_check_security_for_return_value': is_check_security_for_return_value ,
165 'is_custom': 'Custom' in extended_attributes and 172 'is_custom': 'Custom' in extended_attributes and
166 not (is_custom_call_prologue or is_custom_call_epilogue), 173 not (is_custom_call_prologue or is_custom_call_epilogue),
167 'is_custom_call_prologue': is_custom_call_prologue, 174 'is_custom_call_prologue': is_custom_call_prologue,
168 'is_custom_call_epilogue': is_custom_call_epilogue, 175 'is_custom_call_epilogue': is_custom_call_epilogue,
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return method.idl_type and method.idl_type.name == 'Promise' 484 return method.idl_type and method.idl_type.name == 'Promise'
478 485
479 IdlOperation.returns_promise = property(method_returns_promise) 486 IdlOperation.returns_promise = property(method_returns_promise)
480 487
481 488
482 def argument_conversion_needs_exception_state(method, argument): 489 def argument_conversion_needs_exception_state(method, argument):
483 idl_type = argument.idl_type 490 idl_type = argument.idl_type
484 return (idl_type.v8_conversion_needs_exception_state or 491 return (idl_type.v8_conversion_needs_exception_state or
485 argument.is_variadic or 492 argument.is_variadic or
486 (method.returns_promise and idl_type.is_string_type)) 493 (method.returns_promise and idl_type.is_string_type))
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/v8_interface.py ('k') | third_party/WebKit/Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698