summaryrefslogtreecommitdiffstats
path: root/rlz
diff options
context:
space:
mode:
authorki.stfu <ki.stfu@gmail.com>2015-09-20 15:38:05 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-20 22:38:39 +0000
commit116c75065a67be6a7c5b01dfd562beec97f71670 (patch)
tree71dd1c5feacf93790a792e4a16c8a97d79810ab2 /rlz
parentbfacce0691d0ffe7551e2b35a816c1503a9d489a (diff)
downloadchromium_src-116c75065a67be6a7c5b01dfd562beec97f71670.zip
chromium_src-116c75065a67be6a7c5b01dfd562beec97f71670.tar.gz
chromium_src-116c75065a67be6a7c5b01dfd562beec97f71670.tar.bz2
Cleanup: Pass std::string as const reference from rlz/
Passing std::string by reference can prevent extra copying of object. BUG=367418 TEST= R=rogerta@chromium.org,thakis@chromium.org Review URL: https://codereview.chromium.org/1353323003 Cr-Commit-Position: refs/heads/master@{#349885}
Diffstat (limited to 'rlz')
-rw-r--r--rlz/chromeos/lib/rlz_value_store_chromeos.cc8
-rw-r--r--rlz/chromeos/lib/rlz_value_store_chromeos.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.cc b/rlz/chromeos/lib/rlz_value_store_chromeos.cc
index b02ce34..80d269e 100644
--- a/rlz/chromeos/lib/rlz_value_store_chromeos.cc
+++ b/rlz/chromeos/lib/rlz_value_store_chromeos.cc
@@ -61,7 +61,7 @@ base::FilePath GetRlzStoreLockPath() {
}
// Returns the dictionary key for storing access point-related prefs.
-std::string GetKeyName(std::string key, AccessPoint access_point) {
+std::string GetKeyName(const std::string& key, AccessPoint access_point) {
std::string brand = SupplementaryBranding::GetBrand();
if (brand.empty())
brand = kNoSupplementaryBrand;
@@ -69,7 +69,7 @@ std::string GetKeyName(std::string key, AccessPoint access_point) {
}
// Returns the dictionary key for storing product-related prefs.
-std::string GetKeyName(std::string key, Product product) {
+std::string GetKeyName(const std::string& key, Product product) {
std::string brand = SupplementaryBranding::GetBrand();
if (brand.empty())
brand = kNoSupplementaryBrand;
@@ -242,7 +242,7 @@ void RlzValueStoreChromeOS::WriteStore() {
LOG(ERROR) << "Error writing RLZ store";
}
-bool RlzValueStoreChromeOS::AddValueToList(std::string list_name,
+bool RlzValueStoreChromeOS::AddValueToList(const std::string& list_name,
base::Value* value) {
base::ListValue* list_value = NULL;
if (!rlz_store_->GetList(list_name, &list_value)) {
@@ -253,7 +253,7 @@ bool RlzValueStoreChromeOS::AddValueToList(std::string list_name,
return true;
}
-bool RlzValueStoreChromeOS::RemoveValueFromList(std::string list_name,
+bool RlzValueStoreChromeOS::RemoveValueFromList(const std::string& list_name,
const base::Value& value) {
base::ListValue* list_value = NULL;
if (!rlz_store_->GetList(list_name, &list_value))
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.h b/rlz/chromeos/lib/rlz_value_store_chromeos.h
index 9f92549..946d56b 100644
--- a/rlz/chromeos/lib/rlz_value_store_chromeos.h
+++ b/rlz/chromeos/lib/rlz_value_store_chromeos.h
@@ -64,9 +64,10 @@ class RlzValueStoreChromeOS : public RlzValueStore,
void WriteStore();
// Adds |value| to list at |list_name| path in JSON store.
- bool AddValueToList(std::string list_name, base::Value* value);
+ bool AddValueToList(const std::string& list_name, base::Value* value);
// Removes |value| from list at |list_name| path in JSON store.
- bool RemoveValueFromList(std::string list_name, const base::Value& value);
+ bool RemoveValueFromList(const std::string& list_name,
+ const base::Value& value);
// In-memory store with RLZ data.
scoped_ptr<base::DictionaryValue> rlz_store_;