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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed. Much less added generations. 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 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 import idl_definitions 39 import idl_definitions
40 from idl_definitions import IdlOperation, IdlArgument 40 from idl_definitions import IdlOperation, IdlArgument
41 import idl_types 41 import idl_types
42 from idl_types import IdlType, inherits_interface 42 from idl_types import IdlType, inherits_interface
43 import v8_attributes 43 import v8_attributes
44 from v8_globals import includes 44 from v8_globals import includes
45 import v8_methods 45 import v8_methods
46 import v8_types 46 import v8_types
47 from v8_types import cpp_ptr_type, cpp_template_type 47 from v8_types import cpp_ptr_type, cpp_template_type
48 import v8_utilities 48 import v8_utilities
49 from v8_utilities import (cpp_name_or_partial, capitalize, conditional_string, c pp_name, gc_type, 49 from v8_utilities import (api_experiment_enabled_function, cpp_name_or_partial, capitalize, conditional_string, cpp_name, gc_type,
50 has_extended_attribute_value, runtime_enabled_function _name, 50 has_extended_attribute_value, runtime_enabled_function _name,
51 extended_attribute_value_as_list, is_legacy_interface_ type_checking) 51 extended_attribute_value_as_list, is_legacy_interface_ type_checking)
52 52
53 53
54 INTERFACE_H_INCLUDES = frozenset([ 54 INTERFACE_H_INCLUDES = frozenset([
55 'bindings/core/v8/ScriptWrappable.h', 55 'bindings/core/v8/ScriptWrappable.h',
56 'bindings/core/v8/ToV8.h', 56 'bindings/core/v8/ToV8.h',
57 'bindings/core/v8/V8Binding.h', 57 'bindings/core/v8/V8Binding.h',
58 'bindings/core/v8/V8DOMWrapper.h', 58 'bindings/core/v8/V8DOMWrapper.h',
59 'bindings/core/v8/WrapperTypeInfo.h', 59 'bindings/core/v8/WrapperTypeInfo.h',
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 this_gc_type = gc_type(interface) 156 this_gc_type = gc_type(interface)
157 157
158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId') 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId')
159 159
160 v8_class_name = v8_utilities.v8_class_name(interface) 160 v8_class_name = v8_utilities.v8_class_name(interface)
161 cpp_class_name = cpp_name(interface) 161 cpp_class_name = cpp_name(interface)
162 cpp_class_name_or_partial = cpp_name_or_partial(interface) 162 cpp_class_name_or_partial = cpp_name_or_partial(interface)
163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface)
164 164
165 if 'APIExperimentEnabled' in extended_attributes:
166 includes.add('core/experiments/ExperimentalFeatures.h')
167 includes.add('core/inspector/ConsoleMessage.h')
168
165 context = { 169 context = {
170 'api_experiment_name': v8_utilities.api_experiment_name(interface),
166 'conditional_string': conditional_string(interface), # [Conditional] 171 'conditional_string': conditional_string(interface), # [Conditional]
167 'cpp_class': cpp_class_name, 172 'cpp_class': cpp_class_name,
168 'cpp_class_or_partial': cpp_class_name_or_partial, 173 'cpp_class_or_partial': cpp_class_name_or_partial,
169 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget', 174 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget',
170 'gc_type': this_gc_type, 175 'gc_type': this_gc_type,
171 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 176 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699
172 'has_access_check_callbacks': (is_check_security and 177 'has_access_check_callbacks': (is_check_security and
173 interface.name != 'Window' and 178 interface.name != 'Window' and
174 interface.name != 'EventTarget'), 179 interface.name != 'EventTarget'),
175 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] 180 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction]
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 'unscopeables': sorted(unscopeables), 259 'unscopeables': sorted(unscopeables),
255 }) 260 })
256 261
257 constants = [constant_context(constant, interface) for constant in interface .constants] 262 constants = [constant_context(constant, interface) for constant in interface .constants]
258 263
259 special_getter_constants = [] 264 special_getter_constants = []
260 runtime_enabled_constants = dict() 265 runtime_enabled_constants = dict()
261 constant_configuration_constants = [] 266 constant_configuration_constants = []
262 267
263 for constant in constants: 268 for constant in constants:
264 if constant['measure_as'] or constant['deprecate_as']: 269 if constant['measure_as'] or constant['deprecate_as'] or constant['api_e xperiment_name']:
265 special_getter_constants.append(constant) 270 special_getter_constants.append(constant)
266 continue 271 continue
267 runtime_enabled_function = constant['runtime_enabled_function'] 272 runtime_enabled_function = constant['runtime_enabled_function']
268 if runtime_enabled_function: 273 if runtime_enabled_function:
269 if runtime_enabled_function not in runtime_enabled_constants: 274 if runtime_enabled_function not in runtime_enabled_constants:
270 runtime_enabled_constants[runtime_enabled_function] = [] 275 runtime_enabled_constants[runtime_enabled_function] = []
271 runtime_enabled_constants[runtime_enabled_function].append(constant) 276 runtime_enabled_constants[runtime_enabled_function].append(constant)
272 continue 277 continue
273 constant_configuration_constants.append(constant) 278 constant_configuration_constants.append(constant)
274 279
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 context.update({ 604 context.update({
600 'has_named_properties_object': is_global and context['named_property_get ter'], 605 'has_named_properties_object': is_global and context['named_property_get ter'],
601 }) 606 })
602 607
603 return context 608 return context
604 609
605 610
606 # [DeprecateAs], [Reflect], [RuntimeEnabled] 611 # [DeprecateAs], [Reflect], [RuntimeEnabled]
607 def constant_context(constant, interface): 612 def constant_context(constant, interface):
608 extended_attributes = constant.extended_attributes 613 extended_attributes = constant.extended_attributes
614
615 if 'APIExperimentEnabled' in extended_attributes:
616 includes.add('core/experiments/ExperimentalFeatures.h')
617 includes.add('core/inspector/ConsoleMessage.h')
618
609 return { 619 return {
620 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(c onstant), # [APIExperimentEnabled]
621 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab led_function(interface), # [APIExperimentEnabled]
622 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'), # [APIExperimentEnabled]
610 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), 623 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
611 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] 624 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs]
612 'idl_type': constant.idl_type.name, 625 'idl_type': constant.idl_type.name,
626 'is_api_experiment_enabled': v8_utilities.api_experiment_enabled_functio n(constant) or v8_utilities.api_experiment_enabled_function(interface), # [APIE xperimentEnabled]
613 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s] 627 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s]
614 'name': constant.name, 628 'name': constant.name,
615 # FIXME: use 'reflected_name' as correct 'name' 629 # FIXME: use 'reflected_name' as correct 'name'
616 'reflected_name': extended_attributes.get('Reflect', constant.name), 630 'reflected_name': extended_attributes.get('Reflect', constant.name),
617 'runtime_enabled_function': runtime_enabled_function_name(constant), 631 'runtime_enabled_function': runtime_enabled_function_name(constant),
618 'value': constant.value, 632 'value': constant.value,
619 } 633 }
620 634
621 635
622 ################################################################################ 636 ################################################################################
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 1399
1386 extended_attributes = deleter.extended_attributes 1400 extended_attributes = deleter.extended_attributes
1387 idl_type = deleter.idl_type 1401 idl_type = deleter.idl_type
1388 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1402 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1389 return { 1403 return {
1390 'is_call_with_script_state': is_call_with_script_state, 1404 'is_call_with_script_state': is_call_with_script_state,
1391 'is_custom': 'Custom' in extended_attributes, 1405 'is_custom': 'Custom' in extended_attributes,
1392 'is_raises_exception': 'RaisesException' in extended_attributes, 1406 'is_raises_exception': 'RaisesException' in extended_attributes,
1393 'name': cpp_name(deleter), 1407 'name': cpp_name(deleter),
1394 } 1408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698