| 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/dom/ExecutionContext.h" |
| 6 #include "core/origin_trials/OriginTrialContext.h" | 7 #include "core/origin_trials/OriginTrialContext.h" |
| 7 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 11 |
| 12 OriginTrials::OriginTrials(OriginTrialContext* originTrialContext) : m_originTri
alContext(originTrialContext) {} |
| 13 |
| 10 {% for feature in features %} | 14 {% for feature in features %} |
| 11 {% if feature.origin_trial_feature_name %} | 15 {% if feature.origin_trial_feature_name %} |
| 12 | 16 |
| 13 // static | 17 // static |
| 14 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext, String& errorMessage) { | 18 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext, String& errorMessage) { |
| 15 return {{feature.first_lowered_name}}EnabledImpl(executionContext, &errorMes
sage); | 19 return executionContext->originTrials()->{{feature.first_lowered_name}}Enabl
ed(errorMessage); |
| 16 } | 20 } |
| 17 | 21 |
| 18 // static | 22 bool OriginTrials::{{feature.first_lowered_name}}Enabled(String& errorMessage) { |
| 19 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext) { | 23 return {{feature.first_lowered_name}}EnabledImpl(&errorMessage); |
| 20 return {{feature.first_lowered_name}}EnabledImpl(executionContext, nullptr); | 24 } |
| 25 |
| 26 bool OriginTrials::{{feature.first_lowered_name}}Enabled() { |
| 27 return {{feature.first_lowered_name}}EnabledImpl(nullptr); |
| 21 } | 28 } |
| 22 {% endif %} | 29 {% endif %} |
| 23 {% endfor %} | 30 {% endfor %} |
| 24 | 31 |
| 25 {% for feature in features %} | 32 {% for feature in features %} |
| 26 {% if feature.origin_trial_feature_name %} | 33 {% if feature.origin_trial_feature_name %} |
| 27 | 34 |
| 28 // static | 35 bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(String* errorMessag
e) { |
| 29 bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(ExecutionContext* e
xecutionContext, String* errorMessage) { | |
| 30 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) | 36 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) |
| 31 return true; | 37 return true; |
| 32 return OriginTrialContext::isFeatureEnabled(executionContext, "{{feature.ori
gin_trial_feature_name}}", errorMessage); | 38 if (!m_originTrialContext) return false; |
| 39 return m_originTrialContext->isFeatureEnabled("{{feature.origin_trial_featur
e_name}}", errorMessage); |
| 33 } | 40 } |
| 34 {% endif %} | 41 {% endif %} |
| 35 {% endfor %} | 42 {% endfor %} |
| 36 | 43 |
| 37 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |