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

Side by Side 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 unified diff | Download patch
OLDNEW
1 {% from 'macros.tmpl' import license %} 1 {% from 'macros.tmpl' import license %}
2 {{license()}} 2 {{license()}}
3 3
4 #include "core/origin_trials/OriginTrials.h" 4 #include "core/origin_trials/OriginTrials.h"
5 5
6 #include "core/origin_trials/OriginTrialContext.h" 6 #include "core/origin_trials/OriginTrialContext.h"
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 namespace {
12
13 {% for feature in features %} 11 {% for feature in features %}
14 {% if feature.origin_trial_feature_name %} 12 {% if feature.origin_trial_feature_name %}
15 13
16 bool {{feature.first_lowered_name}}EnabledImpl(ExecutionContext* executionContex t, String* errorMessage) { 14 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu tionContext) {
17 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) 15 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled())
18 return true; 16 return true;
19 OriginTrialContext* context = OriginTrialContext::from(executionContext); 17 OriginTrialContext* context = OriginTrialContext::from(executionContext, Ori ginTrialContext::DontCreateIfNotExists);
20 return context->isFeatureEnabled("{{feature.origin_trial_feature_name}}", er rorMessage); 18 return context && context->isFeatureEnabled("{{feature.origin_trial_feature_ name}}");
21 } 19 }
22 20
23 {% endif %} 21 {% endif %}
24 {% endfor %}
25
26 } // namespace
27
28 {% for feature in features %}
29 {% if feature.origin_trial_feature_name %}
30
31 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu tionContext, String& errorMessage) {
32 return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMes sage);
33 }
34
35 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu tionContext) {
36 return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr);
37 }
38
39 {% endif %}
40 {% endfor %} 22 {% endfor %}
41 23
42 } // namespace blink 24 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698