| 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/dom/ExecutionContext.h" |
| 7 #include "core/origin_trials/OriginTrialContext.h" | 7 #include "core/origin_trials/OriginTrialContext.h" |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 | 9 |
| 10 |
| 11 // This file defines only the automatically generated methods of the |
| 12 // OriginTrials class. For the remainder of the methods declared in the header, |
| 13 // see third_party/WebKit/Source/core/origin_trials/OriginTrialsImpl.cpp |
| 14 |
| 10 namespace blink { | 15 namespace blink { |
| 11 | 16 |
| 12 OriginTrials::OriginTrials(PassOwnPtrWillBeRawPtr<OriginTrialContext> originTria
lContext) | |
| 13 : m_originTrialContext(originTrialContext) {} | |
| 14 | |
| 15 // static | |
| 16 const char* OriginTrials::supplementName() | |
| 17 { | |
| 18 return "OriginTrials"; | |
| 19 } | |
| 20 | |
| 21 // static | |
| 22 OriginTrials* OriginTrials::from(ExecutionContext* host) | |
| 23 { | |
| 24 OriginTrials* originTrials = reinterpret_cast<OriginTrials*>(WillBeHeapSuppl
ement<ExecutionContext>::from(host, supplementName())); | |
| 25 if (!originTrials) { | |
| 26 originTrials = new OriginTrials(host->createOriginTrialContext()); | |
| 27 WillBeHeapSupplement<ExecutionContext>::provideTo(*host, supplementName(
), adoptPtrWillBeNoop(originTrials)); | |
| 28 } | |
| 29 return originTrials; | |
| 30 } | |
| 31 | |
| 32 {% for feature in features %} | 17 {% for feature in features %} |
| 33 {% if feature.origin_trial_feature_name %} | 18 {% if feature.origin_trial_feature_name %} |
| 34 | 19 |
| 35 // static | 20 // static |
| 36 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext, String& errorMessage) { | 21 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext, String& errorMessage) { |
| 37 return OriginTrials::from(executionContext)->{{feature.first_lowered_name}}E
nabledImpl(&errorMessage); | 22 return OriginTrials::from(executionContext)->{{feature.first_lowered_name}}E
nabledImpl(&errorMessage); |
| 38 } | 23 } |
| 39 | 24 |
| 40 // static | 25 // static |
| 41 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext) { | 26 bool OriginTrials::{{feature.first_lowered_name}}Enabled(ExecutionContext* execu
tionContext) { |
| 42 return OriginTrials::from(executionContext)->{{feature.first_lowered_name}}E
nabledImpl(nullptr); | 27 return OriginTrials::from(executionContext)->{{feature.first_lowered_name}}E
nabledImpl(nullptr); |
| 43 } | 28 } |
| 44 | 29 |
| 45 {% endif %} | 30 {% endif %} |
| 46 {% endfor %} | 31 {% endfor %} |
| 47 | 32 |
| 48 {% for feature in features %} | 33 {% for feature in features %} |
| 49 {% if feature.origin_trial_feature_name %} | 34 {% if feature.origin_trial_feature_name %} |
| 50 | 35 |
| 51 bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(String* errorMessag
e) { | 36 bool OriginTrials::{{feature.first_lowered_name}}EnabledImpl(String* errorMessag
e) { |
| 52 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) | 37 if (RuntimeEnabledFeatures::{{feature.first_lowered_name}}Enabled()) |
| 53 return true; | 38 return true; |
| 54 if (!m_originTrialContext) return false; | 39 if (!m_originTrialContext) return false; |
| 55 return m_originTrialContext->isFeatureEnabled("{{feature.origin_trial_featur
e_name}}", errorMessage); | 40 return m_originTrialContext->isFeatureEnabled("{{feature.origin_trial_featur
e_name}}", errorMessage); |
| 56 } | 41 } |
| 57 {% endif %} | 42 {% endif %} |
| 58 {% endfor %} | 43 {% endfor %} |
| 59 | 44 |
| 60 DEFINE_TRACE(OriginTrials) | |
| 61 { | |
| 62 visitor->trace(m_originTrialContext); | |
| 63 WillBeHeapSupplement<ExecutionContext>::trace(visitor); | |
| 64 } | |
| 65 } // namespace blink | 45 } // namespace blink |
| OLD | NEW |