| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {{license()}} | 2 {{license()}} |
| 3 | 3 |
| 4 #include "platform/RuntimeEnabledFeatures.h" | 4 #include "platform/RuntimeEnabledFeatures.h" |
| 5 | 5 |
| 6 #include "wtf/Assertions.h" | 6 #include "wtf/Assertions.h" |
| 7 #include "wtf/text/WTFString.h" | 7 #include "wtf/text/WTFString.h" |
| 8 | 8 |
| 9 namespace { | |
| 10 | |
| 11 bool caseInsensitiveEqual(const std::string& a, const std::string& b) | |
| 12 { | |
| 13 if (a.size() != b.size()) | |
| 14 return false; | |
| 15 for (size_t i = 0; i < a.size(); ++i) { | |
| 16 if (tolower(a[i]) != tolower(b[i])) | |
| 17 return false; | |
| 18 } | |
| 19 return true; | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 namespace blink { | 9 namespace blink { |
| 25 | 10 |
| 26 RuntimeEnabledFeatures::Backup::Backup() | 11 RuntimeEnabledFeatures::Backup::Backup() |
| 27 : | 12 : |
| 28 {% for feature in standard_features %} | 13 {% for feature in standard_features %} |
| 29 {%+ if not loop.first %}, {% endif -%}m_{{feature.first_lowered_name}}(Runti
meEnabledFeatures::{{feature.first_lowered_name}}Enabled()) | 14 {%+ if not loop.first %}, {% endif -%}m_{{feature.first_lowered_name}}(Runti
meEnabledFeatures::{{feature.first_lowered_name}}Enabled()) |
| 30 {% endfor %} | 15 {% endfor %} |
| 31 { | 16 { |
| 32 } | 17 } |
| 33 | 18 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 {% for feature in features if feature.status == feature_set %} | 29 {% for feature in features if feature.status == feature_set %} |
| 45 set{{feature.name}}Enabled(enable); | 30 set{{feature.name}}Enabled(enable); |
| 46 {% endfor %} | 31 {% endfor %} |
| 47 } | 32 } |
| 48 | 33 |
| 49 {% endfor %} | 34 {% endfor %} |
| 50 | 35 |
| 51 void RuntimeEnabledFeatures::setFeatureEnabledFromString(const std::string& name
, bool isEnabled) | 36 void RuntimeEnabledFeatures::setFeatureEnabledFromString(const std::string& name
, bool isEnabled) |
| 52 { | 37 { |
| 53 {% for feature in standard_features %} | 38 {% for feature in standard_features %} |
| 54 if (caseInsensitiveEqual(name, "{{feature.name}}")) { | 39 if (name == "{{feature.name}}") { |
| 55 set{{feature.name}}Enabled(isEnabled); | 40 set{{feature.name}}Enabled(isEnabled); |
| 56 return; | 41 return; |
| 57 } | 42 } |
| 58 {% endfor %} | 43 {% endfor %} |
| 59 DLOG(ERROR) << "RuntimeEnabledFeature not recognized: " << name; | 44 DLOG(ERROR) << "RuntimeEnabledFeature not recognized: " << name; |
| 60 } | 45 } |
| 61 | 46 |
| 62 {% for feature in standard_features %} | 47 {% for feature in standard_features %} |
| 63 bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = {{'true' if feature.sta
tus == 'stable' else 'false'}}; | 48 bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = {{'true' if feature.sta
tus == 'stable' else 'false'}}; |
| 64 {% endfor %} | 49 {% endfor %} |
| 65 | 50 |
| 66 } // namespace blink | 51 } // namespace blink |
| OLD | NEW |