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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_utilities.py

Issue 1861433002: Make [OriginTrialEnabled] and [RuntimeEnabled] mutually exclusive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@586594-separate-tests
Patch Set: Clean up commented code Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_utilities.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
index 723bb55c77a94accf20f7910f852acb16beb121a..5a782707389c81d3c1e985c93ebdbbe72c71bbdc 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
@@ -366,27 +366,31 @@ def measure_as(definition_or_member, interface):
return None
-def runtime_feature_name(definition_or_member):
+# [OriginTrialEnabled]
+def origin_trial_enabled(definition_or_member, interface):
iclelland 2016/04/05 13:38:58 This function's name suggests that it is a boolean
chasej 2016/04/05 19:50:22 The function is implemented similar to the depreca
iclelland 2016/04/07 14:00:31 With the obvious parallels to RuntimeEnabled code,
extended_attributes = definition_or_member.extended_attributes
- if 'RuntimeEnabled' not in extended_attributes:
- return None
- return extended_attributes['RuntimeEnabled']
+ is_origin_trial_enabled = 'OriginTrialEnabled' in extended_attributes
+ if (is_origin_trial_enabled and 'RuntimeEnabled' in extended_attributes):
iclelland 2016/04/05 13:38:58 Is there a compelling reason for this check to be
chasej 2016/04/05 19:50:22 I had the check here because it really belongs to
iclelland 2016/04/07 14:00:32 It just seems like an obvious symmetry, that it co
+ raise Exception('[OriginTrialEnabled] and [RuntimeEnabled] must '
iclelland 2016/04/05 13:38:58 I'd expect a more specific exception type to be ra
chasej 2016/04/05 19:50:22 Other than a few specific scenarios, most of the b
iclelland 2016/04/07 14:00:32 Acknowledged. All I had seen (without looking *too
+ 'not be specified on the same definition: '
+ '%s.%s' % (definition_or_member.idl_name, definition_or_member.name))
-def is_origin_trial_enabled(definition_or_member):
- return 'OriginTrialEnabled' in definition_or_member.extended_attributes
+ if is_origin_trial_enabled:
+ includes.add('core/inspector/ConsoleMessage.h')
+ includes.add('core/origin_trials/OriginTrials.h')
+ trial_name = extended_attributes['OriginTrialEnabled']
+ return 'OriginTrials::%sEnabled' % uncapitalize(trial_name)
-def origin_trial_name(definition_or_member):
- return definition_or_member.extended_attributes['OriginTrialEnabled'] if is_origin_trial_enabled(definition_or_member) else None
+ return None
-def origin_trial_enabled_function(definition_or_member):
- trial_name = origin_trial_name(definition_or_member)
- feature_name = runtime_feature_name(definition_or_member)
- if not feature_name or not trial_name:
- return
- return 'OriginTrials::%sEnabled' % uncapitalize(feature_name)
+def runtime_feature_name(definition_or_member):
+ extended_attributes = definition_or_member.extended_attributes
+ if 'RuntimeEnabled' not in extended_attributes:
+ return None
+ return extended_attributes['RuntimeEnabled']
# [RuntimeEnabled]
@@ -404,9 +408,11 @@ def runtime_enabled_function_name(definition_or_member):
# attributes/methods, so we are acting as though the runtime enabled
# function doesn't exist. (It is checked in the generated OriginTrials
# function, instead)
- trial_name = origin_trial_name(definition_or_member)
- if not feature_name or trial_name:
+ trial_enabled = origin_trial_enabled(definition_or_member, None)
+ if not feature_name or trial_enabled:
haraken 2016/04/05 01:23:18 Do we still need this check?
chasej 2016/04/05 19:50:22 You're right, we probably don't need this check an
return
+
+ includes.add('platform/RuntimeEnabledFeatures.h')
return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)

Powered by Google App Engine
This is Rietveld 408576698