summaryrefslogtreecommitdiffstats
path: root/chromeos/network
diff options
context:
space:
mode:
authorki.stfu <ki.stfu@gmail.com>2015-09-21 17:56:52 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-22 00:57:25 +0000
commitd3709b5f91fe5d0d4accd7386da5a61743824b9e (patch)
treeffd618fc74a2588a96fc42be809f0dbf5ee0a93f /chromeos/network
parent15b28d658c5a66655c19a7299f2e50fcd7b591c3 (diff)
downloadchromium_src-d3709b5f91fe5d0d4accd7386da5a61743824b9e.zip
chromium_src-d3709b5f91fe5d0d4accd7386da5a61743824b9e.tar.gz
chromium_src-d3709b5f91fe5d0d4accd7386da5a61743824b9e.tar.bz2
Cleanup: Pass std::string as const reference from chromeos/
Passing std::string by reference can prevent extra copying of object. BUG=367418 TEST= R=zelidrag@chromium.org,derat@chromium.org,gauravsh@chromium.org Review URL: https://codereview.chromium.org/1353323002 Cr-Commit-Position: refs/heads/master@{#350078}
Diffstat (limited to 'chromeos/network')
-rw-r--r--chromeos/network/network_connection_handler.h4
-rw-r--r--chromeos/network/onc/onc_certificate_importer_impl_unittest.cc5
-rw-r--r--chromeos/network/shill_property_util.cc2
-rw-r--r--chromeos/network/shill_property_util.h2
4 files changed, 9 insertions, 4 deletions
diff --git a/chromeos/network/network_connection_handler.h b/chromeos/network/network_connection_handler.h
index ddadf7a..8b4e93f 100644
--- a/chromeos/network/network_connection_handler.h
+++ b/chromeos/network/network_connection_handler.h
@@ -193,7 +193,11 @@ class CHROMEOS_EXPORT NetworkConnectionHandler
const std::string& error_name,
const std::string& error_message);
+ // Note: |service_path| is passed by value here, because in some cases
+ // the value may be located in the map and then it can be deleted, producing
+ // a reference to invalid memory.
void CheckPendingRequest(const std::string service_path);
+
void CheckAllPendingRequests();
// Notify caller and observers that the connect request succeeded.
diff --git a/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc b/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
index 35ff424..caa5ed8 100644
--- a/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
+++ b/chromeos/network/onc/onc_certificate_importer_impl_unittest.cc
@@ -97,7 +97,8 @@ class ONCCertificateImporterImplTest : public testing::Test {
web_trust_certificates_ = onc_trusted_certificates;
}
- void AddCertificatesFromFile(std::string filename, bool expected_success) {
+ void AddCertificatesFromFile(const std::string& filename,
+ bool expected_success) {
scoped_ptr<base::DictionaryValue> onc =
test_utils::ReadTestDictionary(filename);
scoped_ptr<base::Value> certificates_value;
@@ -122,7 +123,7 @@ class ONCCertificateImporterImplTest : public testing::Test {
private_list_ = ListCertsInPrivateSlot();
}
- void AddCertificateFromFile(std::string filename,
+ void AddCertificateFromFile(const std::string& filename,
net::CertType expected_type,
std::string* guid) {
std::string guid_temporary;
diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc
index 30a6925..c5cafc8 100644
--- a/chromeos/network/shill_property_util.cc
+++ b/chromeos/network/shill_property_util.cc
@@ -61,7 +61,7 @@ bool CopyStringFromDictionary(const base::DictionaryValue& source,
} // namespace
-void SetSSID(const std::string ssid, base::DictionaryValue* properties) {
+void SetSSID(const std::string& ssid, base::DictionaryValue* properties) {
std::string hex_ssid = base::HexEncode(ssid.c_str(), ssid.size());
properties->SetStringWithoutPathExpansion(shill::kWifiHexSsid, hex_ssid);
}
diff --git a/chromeos/network/shill_property_util.h b/chromeos/network/shill_property_util.h
index cc9da9c..f585da4 100644
--- a/chromeos/network/shill_property_util.h
+++ b/chromeos/network/shill_property_util.h
@@ -22,7 +22,7 @@ class NetworkUIData;
namespace shill_property_util {
// Sets the |ssid| in |properties|.
-CHROMEOS_EXPORT void SetSSID(const std::string ssid,
+CHROMEOS_EXPORT void SetSSID(const std::string& ssid,
base::DictionaryValue* properties);
// Returns the SSID from |properties| in UTF-8 encoding. If |verbose_logging| is