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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl

Issue 2123323004: Simplify OriginTrialContext and the way it validates tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark enum as obsolete Created 4 years, 5 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/build/scripts/templates/OriginTrials.cpp.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
index 5201fafe08d234a4ada14e90e4458360ad0bea21..2f16adf781b1b19f52c41d4bd00ee23aae6ebcf2 100644
--- a/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/OriginTrials.cpp.tmpl
@@ -8,32 +8,14 @@
namespace blink {
-namespace {
-
{% for feature in features %}
{% if feature.origin_trial_feature_name %}
-bool {{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContext, String* errorMessage) {
+bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext) {
if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled())
return true;
- OriginTrialContext* context = OriginTrialContext::from(executionContext);
- return context->isFeatureEnabled("{{feature.origin_trial_feature_name}}", errorMessage);
-}
-
-{% endif %}
-{% endfor %}
-
-} // namespace
-
-{% for feature in features %}
-{% if feature.origin_trial_feature_name %}
-
-bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext, String& errorMessage) {
- return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMessage);
-}
-
-bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* executionContext) {
- return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr);
+ OriginTrialContext* context = OriginTrialContext::from(executionContext, OriginTrialContext::DontCreateIfNotExists);
+ return context && context->isFeatureEnabled("{{feature.origin_trial_feature_name}}");
}
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698