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

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: Work for a comment 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name) 420 return 'FeaturePolicy::%sEnabled' % uncapitalize(trial_name)
421 421
422 return None 422 return None
423 423
424 424
425 def origin_trial_feature_name(definition_or_member): 425 def origin_trial_feature_name(definition_or_member):
426 extended_attributes = definition_or_member.extended_attributes 426 extended_attributes = definition_or_member.extended_attributes
427 return extended_attributes.get('OriginTrialEnabled') or extended_attributes. get('FeaturePolicy') 427 return extended_attributes.get('OriginTrialEnabled') or extended_attributes. get('FeaturePolicy')
428 428
429 429
430 def runtime_feature_name(definition_or_member): 430 # [RuntimeEnabled]
431 def runtime_enabled_feature_name(definition_or_member):
431 extended_attributes = definition_or_member.extended_attributes 432 extended_attributes = definition_or_member.extended_attributes
432 if 'RuntimeEnabled' not in extended_attributes: 433 if 'RuntimeEnabled' not in extended_attributes:
433 return None 434 return None
435 includes.add('platform/RuntimeEnabledFeatures.h')
434 return extended_attributes['RuntimeEnabled'] 436 return extended_attributes['RuntimeEnabled']
435 437
436 438
437 # [RuntimeEnabled]
438 def runtime_enabled_function_name(definition_or_member):
439 """Returns the name of the RuntimeEnabledFeatures function.
440
441 The returned function checks if a method/attribute is enabled.
442 Given extended attribute RuntimeEnabled=FeatureName, return:
443 RuntimeEnabledFeatures::{featureName}Enabled
444
445 If the RuntimeEnabled extended attribute is found, the includes
446 are also updated as a side-effect.
447 """
448 feature_name = runtime_feature_name(definition_or_member)
449
450 if not feature_name:
451 return
452
453 includes.add('platform/RuntimeEnabledFeatures.h')
454 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
455
456
457 # [Unforgeable] 439 # [Unforgeable]
458 def is_unforgeable(interface, member): 440 def is_unforgeable(interface, member):
459 return (('Unforgeable' in interface.extended_attributes or 441 return (('Unforgeable' in interface.extended_attributes or
460 'Unforgeable' in member.extended_attributes) and 442 'Unforgeable' in member.extended_attributes) and
461 not member.is_static) 443 not member.is_static)
462 444
463 445
464 # [LegacyInterfaceTypeChecking] 446 # [LegacyInterfaceTypeChecking]
465 def is_legacy_interface_type_checking(interface, member): 447 def is_legacy_interface_type_checking(interface, member):
466 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or 448 return ('LegacyInterfaceTypeChecking' in interface.extended_attributes or
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 return None 641 return None
660 642
661 643
662 IdlInterface.legacy_caller = property(legacy_caller) 644 IdlInterface.legacy_caller = property(legacy_caller)
663 IdlInterface.indexed_property_getter = property(indexed_property_getter) 645 IdlInterface.indexed_property_getter = property(indexed_property_getter)
664 IdlInterface.indexed_property_setter = property(indexed_property_setter) 646 IdlInterface.indexed_property_setter = property(indexed_property_setter)
665 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) 647 IdlInterface.indexed_property_deleter = property(indexed_property_deleter)
666 IdlInterface.named_property_getter = property(named_property_getter) 648 IdlInterface.named_property_getter = property(named_property_getter)
667 IdlInterface.named_property_setter = property(named_property_setter) 649 IdlInterface.named_property_setter = property(named_property_setter)
668 IdlInterface.named_property_deleter = property(named_property_deleter) 650 IdlInterface.named_property_deleter = property(named_property_deleter)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698