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_whitelist %} |
| 18 #if |
| 19 {%- for os in feature.origin_trial_os_whitelist %} |
| 20 {%- if not loop.first %} ||{% endif %} |
| 21 defined(OS_{{os | upper}}) |
| 22 {%- endfor %} |
| 23 {% endif %} |
| 24 |
17 OriginTrialContext* context = OriginTrialContext::from(executionContext, Ori
ginTrialContext::DontCreateIfNotExists); | 25 OriginTrialContext* context = OriginTrialContext::from(executionContext, Ori
ginTrialContext::DontCreateIfNotExists); |
18 return context && context->isFeatureEnabled("{{feature.origin_trial_feature_
name}}"); | 26 return context && context->isFeatureEnabled("{{feature.origin_trial_feature_
name}}"); |
| 27 {% if feature.origin_trial_os_whitelist %} |
| 28 #else |
| 29 return false; |
| 30 #endif |
| 31 {% endif %} |
19 } | 32 } |
20 | 33 |
21 {% endif %} | 34 {% endif %} |
22 {% endfor %} | 35 {% endfor %} |
23 | 36 |
24 } // namespace blink | 37 } // namespace blink |
OLD | NEW |