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

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

Issue 1259763006: Use std::string instead of WebString in WebRuntimeFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months 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
« no previous file with comments | « no previous file | Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'macros.tmpl' import license %} 1 {% from 'macros.tmpl' import license %}
2 {{license()}} 2 {{license()}}
3 3
4 #include "config.h" 4 #include "config.h"
5 #include "platform/RuntimeEnabledFeatures.h" 5 #include "platform/RuntimeEnabledFeatures.h"
6 6
7 #include "wtf/Assertions.h" 7 #include "wtf/Assertions.h"
8 #include "wtf/text/WTFString.h" 8 #include "wtf/text/WTFString.h"
9 9
10 namespace {
11
12 bool caseInsensitiveEqual(const std::string& a, const std::string& b)
13 {
14 if (a.size() != b.size())
15 return false;
16 for (size_t i = 0; i < a.size(); ++i) {
17 if (tolower(a[i]) != tolower(b[i]))
18 return false;
19 }
20 return true;
21 }
22
23 } // namespace
24
10 namespace blink { 25 namespace blink {
11 26
12 {% for feature_set in feature_sets %} 27 {% for feature_set in feature_sets %}
13 void RuntimeEnabledFeatures::set{{feature_set|capitalize}}FeaturesEnabled(bool e nable) 28 void RuntimeEnabledFeatures::set{{feature_set|capitalize}}FeaturesEnabled(bool e nable)
14 { 29 {
15 {% for feature in features if feature.status == feature_set %} 30 {% for feature in features if feature.status == feature_set %}
16 set{{feature.name}}Enabled(enable); 31 set{{feature.name}}Enabled(enable);
17 {% endfor %} 32 {% endfor %}
18 } 33 }
19 34
20 {% endfor %} 35 {% endfor %}
21 36
22 void RuntimeEnabledFeatures::setFeatureEnabledFromString(const String& name, boo l isEnabled) 37 void RuntimeEnabledFeatures::setFeatureEnabledFromString(const std::string& name , bool isEnabled)
23 { 38 {
24 {% for feature in features if not feature.custom %} 39 {% for feature in features if not feature.custom %}
25 {% filter enable_conditional(feature.condition) %} 40 {% filter enable_conditional(feature.condition) %}
26 if (equalIgnoringCase(name, "{{feature.name}}")) { 41 if (caseInsensitiveEqual(name, "{{feature.name}}")) {
27 set{{feature.name}}Enabled(isEnabled); 42 set{{feature.name}}Enabled(isEnabled);
28 return; 43 return;
29 } 44 }
30 {% endfilter %} 45 {% endfilter %}
31 {% endfor %} 46 {% endfor %}
32 WTF_LOG_ERROR("RuntimeEnabledFeature not recognized: %s", name.ascii().data( )); 47 WTF_LOG_ERROR("RuntimeEnabledFeature not recognized: %s", name.c_str());
33 } 48 }
34 49
35 {% for feature in features if not feature.custom %} 50 {% for feature in features if not feature.custom %}
36 {% filter enable_conditional(feature.condition) %} 51 {% filter enable_conditional(feature.condition) %}
37 bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = {{'true' if feature.sta tus == 'stable' else 'false'}}; 52 bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = {{'true' if feature.sta tus == 'stable' else 'false'}};
38 {% endfilter %} 53 {% endfilter %}
39 {% endfor %} 54 {% endfor %}
40 55
41 } // namespace blink 56 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698