Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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) |
| OLD | NEW |