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

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

Issue 2460423002: Use new LazyDataProperty API for DOM constructors (Closed)
Patch Set: updates 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 def filter_has_accessor_configuration(attributes): 203 def filter_has_accessor_configuration(attributes):
204 return [attribute for attribute in attributes if 204 return [attribute for attribute in attributes if
205 not (attribute['exposed_test'] or 205 not (attribute['exposed_test'] or
206 attribute['secure_context_test'] or 206 attribute['secure_context_test'] or
207 attribute['origin_trial_enabled_function'] or 207 attribute['origin_trial_enabled_function'] or
208 attribute['runtime_enabled_function']) and 208 attribute['runtime_enabled_function']) and
209 not attribute['is_data_type_property'] and 209 not attribute['is_data_type_property'] and
210 attribute['should_be_exposed_to_script']] 210 attribute['should_be_exposed_to_script']]
211 211
212 212
213 def filter_has_attribute_configuration(attributes): 213 def filter_has_data_attribute_configuration(attributes):
214 return [attribute for attribute in attributes if 214 return [attribute for attribute in attributes if
215 not (attribute['exposed_test'] or 215 not (attribute['exposed_test'] or
216 attribute['secure_context_test'] or 216 attribute['secure_context_test'] or
217 attribute['origin_trial_enabled_function'] or 217 attribute['origin_trial_enabled_function'] or
218 attribute['runtime_enabled_function']) and 218 attribute['runtime_enabled_function']) and
219 attribute['is_data_type_property'] and 219 attribute['is_data_type_property'] and
220 attribute['should_be_exposed_to_script']] 220 attribute['should_be_exposed_to_script']]
221 221
222 222
223 def is_lazy_data_attribute(attribute):
224 return attribute['constructor_type'] and not attribute['needs_constructor_ge tter_callback']
225
226
227 def filter_has_attribute_configuration(attributes):
228 return [attribute for attribute in filter_has_data_attribute_configuration(a ttributes) if not is_lazy_data_attribute(attribute)]
229
230
231 def filter_has_lazy_data_attribute_configuration(attributes):
232 return [attribute for attribute in filter_has_data_attribute_configuration(a ttributes) if is_lazy_data_attribute(attribute)]
233
234
223 def filter_origin_trial_enabled(attributes): 235 def filter_origin_trial_enabled(attributes):
224 return [attribute for attribute in attributes if 236 return [attribute for attribute in attributes if
225 attribute['origin_trial_feature_name'] and 237 attribute['origin_trial_feature_name'] and
226 not attribute['exposed_test']] 238 not attribute['exposed_test']]
227 239
228 240
229 def filter_purely_runtime_enabled(attributes): 241 def filter_purely_runtime_enabled(attributes):
230 return [attribute for attribute in attributes if 242 return [attribute for attribute in attributes if
231 not (attribute['exposed_test'] or 243 not (attribute['exposed_test'] or
232 attribute['secure_context_test']) and 244 attribute['secure_context_test']) and
233 attribute['runtime_feature_name']] 245 attribute['runtime_feature_name']]
234 246
235 247
236 def attribute_filters(): 248 def attribute_filters():
237 return {'has_accessor_configuration': filter_has_accessor_configuration, 249 return {'has_accessor_configuration': filter_has_accessor_configuration,
238 'has_attribute_configuration': filter_has_attribute_configuration, 250 'has_attribute_configuration': filter_has_attribute_configuration,
251 'has_lazy_data_attribute_configuration': filter_has_lazy_data_attrib ute_configuration,
239 'origin_trial_enabled_attributes': filter_origin_trial_enabled, 252 'origin_trial_enabled_attributes': filter_origin_trial_enabled,
240 'purely_runtime_enabled_attributes': filter_purely_runtime_enabled} 253 'purely_runtime_enabled_attributes': filter_purely_runtime_enabled}
241 254
242 255
243 ################################################################################ 256 ################################################################################
244 # Getter 257 # Getter
245 ################################################################################ 258 ################################################################################
246 259
247 def getter_context(interface, attribute, context): 260 def getter_context(interface, attribute, context):
248 idl_type = attribute.idl_type 261 idl_type = attribute.idl_type
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 lambda self: strip_suffix(self.base_type, 'Constructor')) 600 lambda self: strip_suffix(self.base_type, 'Constructor'))
588 601
589 602
590 def is_constructor_attribute(attribute): 603 def is_constructor_attribute(attribute):
591 # FIXME: replace this with [ConstructorAttribute] extended attribute 604 # FIXME: replace this with [ConstructorAttribute] extended attribute
592 return attribute.idl_type.name.endswith('Constructor') 605 return attribute.idl_type.name.endswith('Constructor')
593 606
594 607
595 def update_constructor_attribute_context(interface, attribute, context): 608 def update_constructor_attribute_context(interface, attribute, context):
596 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 609 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698