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

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

Issue 2429343004: [CachedAccessor] for window.document. (Closed)
Patch Set: Fix expectation for global-interface-listing-expected, windows. Created 4 years, 1 month 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (base_idl_type == 'EventHandler' and 111 if (base_idl_type == 'EventHandler' and
112 interface.name in ['Window', 'WorkerGlobalScope'] and 112 interface.name in ['Window', 'WorkerGlobalScope'] and
113 attribute.name == 'onerror'): 113 attribute.name == 'onerror'):
114 includes.add('bindings/core/v8/V8ErrorHandler.h') 114 includes.add('bindings/core/v8/V8ErrorHandler.h')
115 115
116 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e') 116 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e')
117 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) 117 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
118 if cached_attribute_validation_method or keep_alive_for_gc: 118 if cached_attribute_validation_method or keep_alive_for_gc:
119 includes.add('bindings/core/v8/V8HiddenValue.h') 119 includes.add('bindings/core/v8/V8HiddenValue.h')
120 120
121 # [CachedAccessor]
122 is_cached_accessor = 'CachedAccessor' in extended_attributes
123 if is_cached_accessor:
124 includes.add('bindings/core/v8/V8PrivateProperty.h')
125
121 context = { 126 context = {
122 'access_control_list': access_control_list(interface, attribute), 127 'access_control_list': access_control_list(interface, attribute),
123 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 128 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
124 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 129 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
125 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging] 130 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging]
126 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 131 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
127 'cached_attribute_validation_method': cached_attribute_validation_method , 132 'cached_attribute_validation_method': cached_attribute_validation_method ,
128 'constructor_type': constructor_type, 133 'constructor_type': constructor_type,
129 'cpp_name': cpp_name(attribute), 134 'cpp_name': cpp_name(attribute),
130 'cpp_type': idl_type.cpp_type, 135 'cpp_type': idl_type.cpp_type,
131 'cpp_type_initializer': idl_type.cpp_type_initializer, 136 'cpp_type_initializer': idl_type.cpp_type_initializer,
132 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 137 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
133 'enum_type': idl_type.enum_type, 138 'enum_type': idl_type.enum_type,
134 'enum_values': idl_type.enum_values, 139 'enum_values': idl_type.enum_values,
135 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] 140 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed]
136 'has_custom_getter': has_custom_getter(attribute), 141 'has_custom_getter': has_custom_getter(attribute),
137 'has_custom_setter': has_custom_setter(attribute), 142 'has_custom_setter': has_custom_setter(attribute),
138 'has_setter': has_setter(interface, attribute), 143 'has_setter': has_setter(interface, attribute),
139 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 144 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
145 'is_cached_accessor': is_cached_accessor,
140 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 146 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
141 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 147 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
142 'is_ce_reactions': is_ce_reactions, 148 'is_ce_reactions': is_ce_reactions,
143 'is_check_security_for_receiver': is_check_security_for_receiver, 149 'is_check_security_for_receiver': is_check_security_for_receiver,
144 'is_check_security_for_return_value': is_check_security_for_return_value , 150 'is_check_security_for_return_value': is_check_security_for_return_value ,
145 'is_custom_element_callbacks': is_custom_element_callbacks, 151 'is_custom_element_callbacks': is_custom_element_callbacks,
146 # TODO(yukishiino): Make all DOM attributes accessor-type properties. 152 # TODO(yukishiino): Make all DOM attributes accessor-type properties.
147 'is_data_type_property': is_data_type_property(interface, attribute), 153 'is_data_type_property': not ('CachedAccessor' in extended_attributes) a nd is_data_type_property(interface, attribute),
148 'is_getter_raises_exception': # [RaisesException] 154 'is_getter_raises_exception': # [RaisesException]
149 'RaisesException' in extended_attributes and 155 'RaisesException' in extended_attributes and
150 extended_attributes['RaisesException'] in (None, 'Getter'), 156 extended_attributes['RaisesException'] in (None, 'Getter'),
151 'is_implemented_in_private_script': is_implemented_in_private_script, 157 'is_implemented_in_private_script': is_implemented_in_private_script,
152 'is_keep_alive_for_gc': keep_alive_for_gc, 158 'is_keep_alive_for_gc': keep_alive_for_gc,
153 'is_lenient_this': 'LenientThis' in extended_attributes, 159 'is_lenient_this': 'LenientThis' in extended_attributes,
154 'is_nullable': idl_type.is_nullable, 160 'is_nullable': idl_type.is_nullable,
155 'is_explicit_nullable': idl_type.is_explicit_nullable, 161 'is_explicit_nullable': idl_type.is_explicit_nullable,
156 'is_partial_interface_member': 162 'is_partial_interface_member':
157 'PartialInterfaceImplementedAs' in extended_attributes, 163 'PartialInterfaceImplementedAs' in extended_attributes,
(...skipping 19 matching lines...) Expand all
177 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa lse', isolate='scriptState->isolate()'), 183 extended_attributes, 'v8Value', 'cppValue', bailout_return_value='fa lse', isolate='scriptState->isolate()'),
178 'property_attributes': property_attributes(interface, attribute), 184 'property_attributes': property_attributes(interface, attribute),
179 'reflect_empty': extended_attributes.get('ReflectEmpty'), 185 'reflect_empty': extended_attributes.get('ReflectEmpty'),
180 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 186 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
181 'reflect_missing': extended_attributes.get('ReflectMissing'), 187 'reflect_missing': extended_attributes.get('ReflectMissing'),
182 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly '), 188 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly '),
183 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] 189 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled]
184 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), # [RuntimeEnabled] 190 'runtime_feature_name': v8_utilities.runtime_feature_name(attribute), # [RuntimeEnabled]
185 'secure_context_test': v8_utilities.secure_context(attribute, interface) , # [SecureContext] 191 'secure_context_test': v8_utilities.secure_context(attribute, interface) , # [SecureContext]
186 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 192 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
193 'cached_accessor_name': '%s%sCachedAccessor' % (interface.name, attribut e.name.capitalize()),
187 'world_suffixes': ( 194 'world_suffixes': (
188 ['', 'ForMainWorld'] 195 ['', 'ForMainWorld']
189 if 'PerWorldBindings' in extended_attributes 196 if 'PerWorldBindings' in extended_attributes
190 else ['']), # [PerWorldBindings] 197 else ['']), # [PerWorldBindings]
191 } 198 }
192 199
193 if is_constructor_attribute(attribute): 200 if is_constructor_attribute(attribute):
194 update_constructor_attribute_context(interface, attribute, context) 201 update_constructor_attribute_context(interface, attribute, context)
195 if not has_custom_getter(attribute): 202 if not has_custom_getter(attribute):
196 getter_context(interface, attribute, context) 203 getter_context(interface, attribute, context)
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 lambda self: strip_suffix(self.base_type, 'Constructor')) 607 lambda self: strip_suffix(self.base_type, 'Constructor'))
601 608
602 609
603 def is_constructor_attribute(attribute): 610 def is_constructor_attribute(attribute):
604 # FIXME: replace this with [ConstructorAttribute] extended attribute 611 # FIXME: replace this with [ConstructorAttribute] extended attribute
605 return attribute.idl_type.name.endswith('Constructor') 612 return attribute.idl_type.name.endswith('Constructor')
606 613
607 614
608 def update_constructor_attribute_context(interface, attribute, context): 615 def update_constructor_attribute_context(interface, attribute, context):
609 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 616 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698