Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl

Issue 2445123002: Make blink settings/features case-sensitive (Closed)
Patch Set: case-sensitive Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698