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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
diff --git a/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl b/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
index fd648b7304d558825b204970e60a074aeac8133a..d3993f271fea812014d611a4a64fe3813afcf000 100644
--- a/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
+++ b/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
@@ -7,6 +7,21 @@
#include "wtf/Assertions.h"
#include "wtf/text/WTFString.h"
+namespace {
+
+bool caseInsensitiveEqual(const std::string& a, const std::string& b)
+{
+ if (a.size() != b.size())
+ return false;
+ for (size_t i = 0; i < a.size(); ++i) {
+ if (tolower(a[i]) != tolower(b[i]))
+ return false;
+ }
+ return true;
+}
+
+} // namespace
+
namespace blink {
{% for feature_set in feature_sets %}
@@ -19,17 +34,17 @@ void RuntimeEnabledFeatures::set{{feature_set|capitalize}}FeaturesEnabled(bool e
{% endfor %}
-void RuntimeEnabledFeatures::setFeatureEnabledFromString(const String& name, bool isEnabled)
+void RuntimeEnabledFeatures::setFeatureEnabledFromString(const std::string& name, bool isEnabled)
{
{% for feature in features if not feature.custom %}
{% filter enable_conditional(feature.condition) %}
- if (equalIgnoringCase(name, "{{feature.name}}")) {
+ if (caseInsensitiveEqual(name, "{{feature.name}}")) {
set{{feature.name}}Enabled(isEnabled);
return;
}
{% endfilter %}
{% endfor %}
- WTF_LOG_ERROR("RuntimeEnabledFeature not recognized: %s", name.ascii().data());
+ WTF_LOG_ERROR("RuntimeEnabledFeature not recognized: %s", name.c_str());
}
{% for feature in features if not feature.custom %}
« 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