| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 return None | 367 return None |
| 368 | 368 |
| 369 | 369 |
| 370 def runtime_feature_name(definition_or_member): | 370 def runtime_feature_name(definition_or_member): |
| 371 extended_attributes = definition_or_member.extended_attributes | 371 extended_attributes = definition_or_member.extended_attributes |
| 372 if 'RuntimeEnabled' not in extended_attributes: | 372 if 'RuntimeEnabled' not in extended_attributes: |
| 373 return None | 373 return None |
| 374 return extended_attributes['RuntimeEnabled'] | 374 return extended_attributes['RuntimeEnabled'] |
| 375 | 375 |
| 376 | 376 |
| 377 def is_api_experiment_enabled(definition_or_member): | 377 def is_origin_trial_enabled(definition_or_member): |
| 378 return 'APIExperimentEnabled' in definition_or_member.extended_attributes | 378 return 'OriginTrialEnabled' in definition_or_member.extended_attributes |
| 379 | 379 |
| 380 | 380 |
| 381 def api_experiment_name(definition_or_member): | 381 def origin_trial_name(definition_or_member): |
| 382 return definition_or_member.extended_attributes['APIExperimentEnabled'] if i
s_api_experiment_enabled(definition_or_member) else None | 382 return definition_or_member.extended_attributes['OriginTrialEnabled'] if is_
origin_trial_enabled(definition_or_member) else None |
| 383 | 383 |
| 384 | 384 |
| 385 def api_experiment_enabled_function(definition_or_member): | 385 def origin_trial_enabled_function(definition_or_member): |
| 386 experiment_name = api_experiment_name(definition_or_member) | 386 trial_name = origin_trial_name(definition_or_member) |
| 387 feature_name = runtime_feature_name(definition_or_member) | 387 feature_name = runtime_feature_name(definition_or_member) |
| 388 if not feature_name or not experiment_name: | 388 if not feature_name or not trial_name: |
| 389 return | 389 return |
| 390 return 'OriginTrials::%sEnabled' % uncapitalize(feature_name) | 390 return 'OriginTrials::%sEnabled' % uncapitalize(feature_name) |
| 391 | 391 |
| 392 | 392 |
| 393 # [RuntimeEnabled] | 393 # [RuntimeEnabled] |
| 394 def runtime_enabled_function_name(definition_or_member): | 394 def runtime_enabled_function_name(definition_or_member): |
| 395 """Returns the name of the RuntimeEnabledFeatures function. | 395 """Returns the name of the RuntimeEnabledFeatures function. |
| 396 | 396 |
| 397 The returned function checks if a method/attribute is enabled. | 397 The returned function checks if a method/attribute is enabled. |
| 398 Given extended attribute RuntimeEnabled=FeatureName, return: | 398 Given extended attribute RuntimeEnabled=FeatureName, return: |
| 399 RuntimeEnabledFeatures::{featureName}Enabled | 399 RuntimeEnabledFeatures::{featureName}Enabled |
| 400 """ | 400 """ |
| 401 feature_name = runtime_feature_name(definition_or_member) | 401 feature_name = runtime_feature_name(definition_or_member) |
| 402 | 402 |
| 403 # If an API experiment is on the method/attribute, it overrides the runtime | 403 # If an origin trial is on the method/attribute, it overrides the runtime |
| 404 # enabled status. For now, we are unconditionally installing experimental | 404 # enabled status. For now, we are unconditionally installing these |
| 405 # attributes/methods, so we are acting as though the runtime enabled | 405 # attributes/methods, so we are acting as though the runtime enabled |
| 406 # function doesn't exist. (It is checked in the generated OriginTrials | 406 # function doesn't exist. (It is checked in the generated OriginTrials |
| 407 # function, instead) | 407 # function, instead) |
| 408 experiment_name = api_experiment_name(definition_or_member) | 408 trial_name = origin_trial_name(definition_or_member) |
| 409 if not feature_name or experiment_name: | 409 if not feature_name or trial_name: |
| 410 return | 410 return |
| 411 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 411 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
| 412 | 412 |
| 413 | 413 |
| 414 # [Unforgeable] | 414 # [Unforgeable] |
| 415 def is_unforgeable(interface, member): | 415 def is_unforgeable(interface, member): |
| 416 return (('Unforgeable' in interface.extended_attributes or | 416 return (('Unforgeable' in interface.extended_attributes or |
| 417 'Unforgeable' in member.extended_attributes) and | 417 'Unforgeable' in member.extended_attributes) and |
| 418 not member.is_static) | 418 not member.is_static) |
| 419 | 419 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 except StopIteration: | 594 except StopIteration: |
| 595 return None | 595 return None |
| 596 | 596 |
| 597 | 597 |
| 598 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 598 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
| 599 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 599 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
| 600 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 600 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
| 601 IdlInterface.named_property_getter = property(named_property_getter) | 601 IdlInterface.named_property_getter = property(named_property_getter) |
| 602 IdlInterface.named_property_setter = property(named_property_setter) | 602 IdlInterface.named_property_setter = property(named_property_setter) |
| 603 IdlInterface.named_property_deleter = property(named_property_deleter) | 603 IdlInterface.named_property_deleter = property(named_property_deleter) |
| OLD | NEW |