OLD | NEW |
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 {% for feature in features %} | 11 {% for feature in features %} |
12 {% if feature.origin_trial_feature_name %} | 12 {% if feature.origin_trial_feature_name %} |
13 | 13 |
14 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext) { | 14 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext) { |
15 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) | 15 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) |
16 return true; | 16 return true; |
17 {% if feature.origin_trial_os %} | 17 {% if feature.origin_trial_os %} |
18 #if | 18 #if |
19 {%- for os in feature.origin_trial_os %} | 19 {%- for os in feature.origin_trial_os %} |
20 {%- if not loop.first %} ||{% endif %} | 20 {%- if not loop.first %} ||{% endif %} |
21 defined(OS_{{os | upper}}) | 21 defined(OS_{{os | upper}}) |
22 {%- endfor %} | 22 {%- endfor %} |
23 {% endif %} | 23 {% endif %} |
24 | 24 |
25 OriginTrialContext* context = OriginTrialContext::from(executionContext, Ori
ginTrialContext::DontCreateIfNotExists); | 25 OriginTrialContext* context = OriginTrialContext::from(executionContext, Ori
ginTrialContext::DontCreateIfNotExists); |
26 return context && context->isFeatureEnabled("{{feature.origin_trial_feature_
name}}"); | 26 return context && context->isTrialEnabled("{{feature.origin_trial_feature_na
me}}"); |
27 {% if feature.origin_trial_os %} | 27 {% if feature.origin_trial_os %} |
28 #else | 28 #else |
29 return false; | 29 return false; |
30 #endif | 30 #endif |
31 {% endif %} | 31 {% endif %} |
32 } | 32 } |
33 | 33 |
34 {% endif %} | 34 {% endif %} |
35 {% endfor %} | 35 {% endfor %} |
36 | 36 |
37 } // namespace blink | 37 } // namespace blink |
OLD | NEW |