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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_attributes.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 # 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 conditional_string = v8_utilities.conditional_string(attribute) 92 conditional_string = v8_utilities.conditional_string(attribute)
93 if conditional_string: 93 if conditional_string:
94 includes.add('wtf/build_config.h') 94 includes.add('wtf/build_config.h')
95 95
96 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e') 96 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e')
97 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) 97 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
98 if cached_attribute_validation_method or keep_alive_for_gc: 98 if cached_attribute_validation_method or keep_alive_for_gc:
99 includes.add('bindings/core/v8/V8HiddenValue.h') 99 includes.add('bindings/core/v8/V8HiddenValue.h')
100 100
101 if 'APIExperimentEnabled' in extended_attributes:
102 includes.add('core/experiments/ExperimentalFeatures.h')
103 includes.add('core/inspector/ConsoleMessage.h')
104
101 context = { 105 context = {
102 'access_control_list': access_control_list(interface, attribute), 106 'access_control_list': access_control_list(interface, attribute),
103 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 107 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
104 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 108 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
105 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging] 109 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging]
110 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(a ttribute), # [APIExperimentEnabled]
111 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab led_function(interface), # [APIExperimentEnabled]
112 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'), # [APIExperimentEnabled]
106 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 113 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
107 'cached_attribute_validation_method': cached_attribute_validation_method , 114 'cached_attribute_validation_method': cached_attribute_validation_method ,
108 'conditional_string': conditional_string, 115 'conditional_string': conditional_string,
109 'constructor_type': constructor_type, 116 'constructor_type': constructor_type,
110 'cpp_name': cpp_name(attribute), 117 'cpp_name': cpp_name(attribute),
111 'cpp_type': idl_type.cpp_type, 118 'cpp_type': idl_type.cpp_type,
112 'cpp_type_initializer': idl_type.cpp_type_initializer, 119 'cpp_type_initializer': idl_type.cpp_type_initializer,
113 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 120 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
114 'enum_type': idl_type.enum_type, 121 'enum_type': idl_type.enum_type,
115 'enum_values': idl_type.enum_values, 122 'enum_values': idl_type.enum_values,
116 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] 123 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed]
117 'has_custom_getter': has_custom_getter(attribute), 124 'has_custom_getter': has_custom_getter(attribute),
118 'has_custom_setter': has_custom_setter(attribute), 125 'has_custom_setter': has_custom_setter(attribute),
119 'has_setter': has_setter(attribute), 126 'has_setter': has_setter(attribute),
120 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 127 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
128 'is_api_experiment_enabled': v8_utilities.api_experiment_enabled_functio n(attribute) or v8_utilities.api_experiment_enabled_function(interface), # [API ExperimentEnabled]
121 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 129 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
122 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 130 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
123 'is_check_security_for_receiver': is_check_security_for_receiver, 131 'is_check_security_for_receiver': is_check_security_for_receiver,
124 'is_check_security_for_return_value': is_check_security_for_return_value , 132 'is_check_security_for_return_value': is_check_security_for_return_value ,
125 'is_custom_element_callbacks': is_custom_element_callbacks, 133 'is_custom_element_callbacks': is_custom_element_callbacks,
126 # TODO(yukishiino): Make all DOM attributes accessor-type properties. 134 # TODO(yukishiino): Make all DOM attributes accessor-type properties.
127 'is_data_type_property': constructor_type or interface.name == 'Window' or interface.name == 'Location', 135 'is_data_type_property': constructor_type or interface.name == 'Window' or interface.name == 'Location',
128 'is_getter_raises_exception': # [RaisesException] 136 'is_getter_raises_exception': # [RaisesException]
129 'RaisesException' in extended_attributes and 137 'RaisesException' in extended_attributes and
130 extended_attributes['RaisesException'] in (None, 'Getter'), 138 extended_attributes['RaisesException'] in (None, 'Getter'),
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 # FIXME: replace this with a [ConstructorAttribute] extended attribute 510 # FIXME: replace this with a [ConstructorAttribute] extended attribute
503 lambda self: strip_suffix(self.base_type, 'Constructor')) 511 lambda self: strip_suffix(self.base_type, 'Constructor'))
504 512
505 513
506 def is_constructor_attribute(attribute): 514 def is_constructor_attribute(attribute):
507 # FIXME: replace this with [ConstructorAttribute] extended attribute 515 # FIXME: replace this with [ConstructorAttribute] extended attribute
508 return attribute.idl_type.name.endswith('Constructor') 516 return attribute.idl_type.name.endswith('Constructor')
509 517
510 518
511 def update_constructor_attribute_context(interface, attribute, context): 519 def update_constructor_attribute_context(interface, attribute, context):
512 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 520 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] or context['api_experiment_name']
haraken 2015/12/31 12:47:22 Do we need this change?
Daniel Nishi 2016/01/04 18:56:31 This is needed so that the check_api_experiment's
513 # When the attribute name is the same as the interface name, do not generate 521 # When the attribute name is the same as the interface name, do not generate
514 # callback functions for each attribute and use 522 # callback functions for each attribute and use
515 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate 523 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate
516 # a callback function in order to hard-code the attribute name. 524 # a callback function in order to hard-code the attribute name.
517 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type'] 525 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698