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

Side by Side Diff: Source/bindings/scripts/v8_utilities.py

Issue 424163002: Enable the WebIDL [Exposed] annotation on an interface's members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove some noise Created 6 years, 4 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 | Annotate | Revision Log
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 # [DeprecateAs] 219 # [DeprecateAs]
220 def deprecate_as(member): 220 def deprecate_as(member):
221 extended_attributes = member.extended_attributes 221 extended_attributes = member.extended_attributes
222 if 'DeprecateAs' not in extended_attributes: 222 if 'DeprecateAs' not in extended_attributes:
223 return None 223 return None
224 includes.add('core/frame/UseCounter.h') 224 includes.add('core/frame/UseCounter.h')
225 return extended_attributes['DeprecateAs'] 225 return extended_attributes['DeprecateAs']
226 226
227 227
228 # [Exposed]
229 def exposed(definition_or_member, interface):
230 extended_attributes = definition_or_member.extended_attributes
231 if 'Exposed' not in extended_attributes:
232 return None
233
234 # FIXME: [Exposed] is an extended attribute, the value of which should be pa rsed
235 # as |ExtendedAttributeIdentList| per the WebIDL parsing rules.
Peter Beverloo 2014/07/29 17:40:26 Note: This was resolved 12 hours ago, and hasn't b
236 exposure_set = set(extended_attributes['Exposed'].split('&'))
bashi 2014/07/30 00:34:34 extended_attributes['Exposed'].split('[|&]') ? I
Peter Beverloo 2014/07/30 14:48:15 I added |sorted_extended_attribute_set| for the ge
237 interface_exposure_set = ('Window') # Default value
Jens Widell 2014/07/29 18:24:29 This ought to be ['Window'] or ('Window',). You're
Peter Beverloo 2014/07/30 14:48:15 Heh, thanks! Done
238
239 interface_extended_attributes = interface.extended_attributes
240 if 'Exposed' in interface_extended_attributes:
241 interface_exposure_set = interface_extended_attributes['Exposed'].split( '&')
242
243 # Methods must not be exposed to a broader scope than their interface.
244 if not exposure_set.issubset(interface_exposure_set):
245 raise Exception('Interface members\' exposure sets must be a subset of t he interface\'s.')
246
247 exposure_checks = []
248 for environment in exposure_set:
249 exposure_checks.append('context->is%s()' % environment)
Peter Beverloo 2014/07/29 17:40:26 Do we have a canonical way of checking what kind o
haraken 2014/07/29 20:13:10 As far as I know, we currently don't have such met
Peter Beverloo 2014/07/30 14:48:15 Done.
250
251 return ' || '.join(exposure_checks)
Peter Beverloo 2014/07/29 17:40:26 Is this the correct layer to join the checks toget
Jens Widell 2014/07/29 18:24:29 You ought to sort somehow here, otherwise code gen
Peter Beverloo 2014/07/30 14:48:15 Done.
252
253
228 # [GarbageCollected], [WillBeGarbageCollected] 254 # [GarbageCollected], [WillBeGarbageCollected]
229 def gc_type(definition): 255 def gc_type(definition):
230 extended_attributes = definition.extended_attributes 256 extended_attributes = definition.extended_attributes
231 if 'GarbageCollected' in extended_attributes: 257 if 'GarbageCollected' in extended_attributes:
232 return 'GarbageCollectedObject' 258 return 'GarbageCollectedObject'
233 elif 'WillBeGarbageCollected' in extended_attributes: 259 elif 'WillBeGarbageCollected' in extended_attributes:
234 return 'WillBeGarbageCollectedObject' 260 return 'WillBeGarbageCollectedObject'
235 return 'RefCountedObject' 261 return 'RefCountedObject'
236 262
237 263
(...skipping 29 matching lines...) Expand all
267 293
268 The returned function checks if a method/attribute is enabled. 294 The returned function checks if a method/attribute is enabled.
269 Given extended attribute RuntimeEnabled=FeatureName, return: 295 Given extended attribute RuntimeEnabled=FeatureName, return:
270 RuntimeEnabledFeatures::{featureName}Enabled 296 RuntimeEnabledFeatures::{featureName}Enabled
271 """ 297 """
272 extended_attributes = definition_or_member.extended_attributes 298 extended_attributes = definition_or_member.extended_attributes
273 if 'RuntimeEnabled' not in extended_attributes: 299 if 'RuntimeEnabled' not in extended_attributes:
274 return None 300 return None
275 feature_name = extended_attributes['RuntimeEnabled'] 301 feature_name = extended_attributes['RuntimeEnabled']
276 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) 302 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698