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

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

Issue 2578943002: [Bindings] Refactoring of binding code around runtime enabled features (Closed)
Patch Set: . Created 4 years 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name) 427 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name)
428 428
429 return None 429 return None
430 430
431 431
432 def origin_trial_feature_name(definition_or_member): 432 def origin_trial_feature_name(definition_or_member):
433 extended_attributes = definition_or_member.extended_attributes 433 extended_attributes = definition_or_member.extended_attributes
434 return extended_attributes.get('OriginTrialEnabled') or extended_attributes. get('FeaturePolicy') 434 return extended_attributes.get('OriginTrialEnabled') or extended_attributes. get('FeaturePolicy')
435 435
436 436
437 # [RuntimeEnabled]
437 def runtime_feature_name(definition_or_member): 438 def runtime_feature_name(definition_or_member):
438 extended_attributes = definition_or_member.extended_attributes 439 extended_attributes = definition_or_member.extended_attributes
439 if 'RuntimeEnabled' not in extended_attributes: 440 if 'RuntimeEnabled' not in extended_attributes:
440 return None 441 return None
442 includes.add('platform/RuntimeEnabledFeatures.h')
441 return extended_attributes['RuntimeEnabled'] 443 return extended_attributes['RuntimeEnabled']
442 444
443 445
444 # [RuntimeEnabled]
445 def runtime_enabled_function_name(definition_or_member):
446 """Returns the name of the RuntimeEnabledFeatures function.
447
448 The returned function checks if a method/attribute is enabled.
449 Given extended attribute RuntimeEnabled=FeatureName, return:
450 RuntimeEnabledFeatures::{featureName}Enabled
451
452 If the RuntimeEnabled extended attribute is found, the includes
453 are also updated as a side-effect.
454 """
455 feature_name = runtime_feature_name(definition_or_member)
456
457 if not feature_name:
458 return
459
460 includes.add('platform/RuntimeEnabledFeatures.h')
461 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
462
463
464 # [Unforgeable] 446 # [Unforgeable]
465 def is_unforgeable(interface, member): 447 def is_unforgeable(interface, member):
466 return (('Unforgeable' in interface.extended_attributes or 448 return (('Unforgeable' in interface.extended_attributes or
467 'Unforgeable' in member.extended_attributes) and 449 'Unforgeable' in member.extended_attributes) and
468 not member.is_static) 450 not member.is_static)
469 451
470 452
471 # [LegacyInterfaceTypeChecking] 453 # [LegacyInterfaceTypeChecking]
472 def is_legacy_interface_type_checking(interface, member): 454 def is_legacy_interface_type_checking(interface, member):
473 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or 455 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 return None 648 return None
667 649
668 650
669 IdlInterface.legacy_caller = property(legacy_caller) 651 IdlInterface.legacy_caller = property(legacy_caller)
670 IdlInterface.indexed_property_getter = property(indexed_property_getter) 652 IdlInterface.indexed_property_getter = property(indexed_property_getter)
671 IdlInterface.indexed_property_setter = property(indexed_property_setter) 653 IdlInterface.indexed_property_setter = property(indexed_property_setter)
672 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) 654 IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
673 IdlInterface.named_property_getter = property(named_property_getter) 655 IdlInterface.named_property_getter = property(named_property_getter)
674 IdlInterface.named_property_setter = property(named_property_setter) 656 IdlInterface.named_property_setter = property(named_property_setter)
675 IdlInterface.named_property_deleter = property(named_property_deleter) 657 IdlInterface.named_property_deleter = property(named_property_deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698