summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 05:45:17 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-09 05:45:17 +0000
commite59558b78e8c6a1b0bd916a724724b638c3c91b6 (patch)
tree712268a7e9e1cd552f309d89641b2bed5ad06322 /chrome/browser/prefs
parent31fcd34da3797bc49160620ef8c94a38652c0587 (diff)
downloadchromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.zip
chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.gz
chromium_src-e59558b78e8c6a1b0bd916a724724b638c3c91b6.tar.bz2
Rewrite std::string("") to std::string(), Linux edition.
This patch was generated by running the empty_string clang tool across the Chromium Linux compilation database. Implicitly or explicitly constructing std::string() with a "" argument is inefficient as the caller needs to emit extra instructions to pass an argument, and the constructor needlessly copies a byte into internal storage. Rewriting these instances to simply call the default constructor appears to save ~14-18 kilobytes on an optimized release build. BUG=none Review URL: https://codereview.chromium.org/13145003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r--chrome/browser/prefs/command_line_pref_store_unittest.cc6
-rw-r--r--chrome/browser/prefs/proxy_config_dictionary.cc30
-rw-r--r--chrome/browser/prefs/proxy_policy_unittest.cc12
-rw-r--r--chrome/browser/prefs/session_startup_pref.cc2
4 files changed, 34 insertions, 16 deletions
diff --git a/chrome/browser/prefs/command_line_pref_store_unittest.cc b/chrome/browser/prefs/command_line_pref_store_unittest.cc
index 5d2c939..1e23383 100644
--- a/chrome/browser/prefs/command_line_pref_store_unittest.cc
+++ b/chrome/browser/prefs/command_line_pref_store_unittest.cc
@@ -116,7 +116,7 @@ TEST(CommandLinePrefStoreTest, MultipleSwitches) {
ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType());
ProxyConfigDictionary dict(static_cast<const DictionaryValue*>(value));
- std::string string_result = "";
+ std::string string_result;
ASSERT_TRUE(dict.GetProxyServer(&string_result));
EXPECT_EQ("proxy", string_result);
@@ -172,9 +172,9 @@ TEST(CommandLinePrefStoreTest, ManualProxyModeInference) {
store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT);
CommandLine cl3(CommandLine::NO_PROGRAM);
- cl3.AppendSwitchASCII(switches::kProxyServer, "");
+ cl3.AppendSwitchASCII(switches::kProxyServer, std::string());
scoped_refptr<TestCommandLinePrefStore> store3 =
- new TestCommandLinePrefStore(&cl3);
+ new TestCommandLinePrefStore(&cl3);
store3->VerifyProxyMode(ProxyPrefs::MODE_DIRECT);
}
diff --git a/chrome/browser/prefs/proxy_config_dictionary.cc b/chrome/browser/prefs/proxy_config_dictionary.cc
index a99fa7c..b6db822 100644
--- a/chrome/browser/prefs/proxy_config_dictionary.cc
+++ b/chrome/browser/prefs/proxy_config_dictionary.cc
@@ -67,12 +67,20 @@ bool ProxyConfigDictionary::HasBypassList() const {
// static
DictionaryValue* ProxyConfigDictionary::CreateDirect() {
- return CreateDictionary(ProxyPrefs::MODE_DIRECT, "", false, "", "");
+ return CreateDictionary(ProxyPrefs::MODE_DIRECT,
+ std::string(),
+ false,
+ std::string(),
+ std::string());
}
// static
DictionaryValue* ProxyConfigDictionary::CreateAutoDetect() {
- return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, "", false, "", "");
+ return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT,
+ std::string(),
+ false,
+ std::string(),
+ std::string());
}
// static
@@ -80,7 +88,10 @@ DictionaryValue* ProxyConfigDictionary::CreatePacScript(
const std::string& pac_url,
bool pac_mandatory) {
return CreateDictionary(ProxyPrefs::MODE_PAC_SCRIPT,
- pac_url, pac_mandatory, "", "");
+ pac_url,
+ pac_mandatory,
+ std::string(),
+ std::string());
}
// static
@@ -88,8 +99,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers(
const std::string& proxy_server,
const std::string& bypass_list) {
if (!proxy_server.empty()) {
- return CreateDictionary(
- ProxyPrefs::MODE_FIXED_SERVERS, "", false, proxy_server, bypass_list);
+ return CreateDictionary(ProxyPrefs::MODE_FIXED_SERVERS,
+ std::string(),
+ false,
+ proxy_server,
+ bypass_list);
} else {
return CreateDirect();
}
@@ -97,7 +111,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers(
// static
DictionaryValue* ProxyConfigDictionary::CreateSystem() {
- return CreateDictionary(ProxyPrefs::MODE_SYSTEM, "", false, "", "");
+ return CreateDictionary(ProxyPrefs::MODE_SYSTEM,
+ std::string(),
+ false,
+ std::string(),
+ std::string());
}
// static
diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc
index ec51894..512e514 100644
--- a/chrome/browser/prefs/proxy_policy_unittest.cc
+++ b/chrome/browser/prefs/proxy_policy_unittest.cc
@@ -68,9 +68,9 @@ void assertBypassList(const ProxyConfigDictionary& dict,
void assertProxyModeWithoutParams(const ProxyConfigDictionary& dict,
ProxyPrefs::ProxyMode proxy_mode) {
assertProxyMode(dict, proxy_mode);
- assertProxyServer(dict, "");
- assertPacUrl(dict, "");
- assertBypassList(dict, "");
+ assertProxyServer(dict, std::string());
+ assertPacUrl(dict, std::string());
+ assertBypassList(dict, std::string());
}
} // namespace
@@ -130,7 +130,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) {
ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy));
assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict, "789");
- assertPacUrl(dict, "");
+ assertPacUrl(dict, std::string());
assertBypassList(dict, "123");
// Try a second time time with the managed PrefStore in place, the
@@ -140,7 +140,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) {
ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy));
assertProxyMode(dict2, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict2, "ghi");
- assertPacUrl(dict2, "");
+ assertPacUrl(dict2, std::string());
assertBypassList(dict2, "abc");
}
@@ -160,7 +160,7 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) {
ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy));
assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS);
assertProxyServer(dict, "789");
- assertPacUrl(dict, "");
+ assertPacUrl(dict, std::string());
assertBypassList(dict, "123");
// Try a second time time with the managed PrefStore in place, the
diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc
index d822cc0..fbbf62f 100644
--- a/chrome/browser/prefs/session_startup_pref.cc
+++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -45,7 +45,7 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) {
for (size_t i = 0; i < url_list->GetSize(); ++i) {
std::string url_text;
if (url_list->GetString(i, &url_text)) {
- GURL fixed_url = URLFixerUpper::FixupURL(url_text, "");
+ GURL fixed_url = URLFixerUpper::FixupURL(url_text, std::string());
pref->urls.push_back(fixed_url);
}
}