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

Unified Diff: third_party/libaddressinput/chromium/chrome_storage_impl.cc

Issue 148463003: libaddressinput - reduce number of copies in storage class by 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
Index: third_party/libaddressinput/chromium/chrome_storage_impl.cc
diff --git a/third_party/libaddressinput/chromium/chrome_storage_impl.cc b/third_party/libaddressinput/chromium/chrome_storage_impl.cc
index 2cd8c01d9aec63a72cd7c63025e9cb9ac9aa0811..db35fc691a49e20afb0613d50eb8a52a41c21fae 100644
--- a/third_party/libaddressinput/chromium/chrome_storage_impl.cc
+++ b/third_party/libaddressinput/chromium/chrome_storage_impl.cc
@@ -15,8 +15,9 @@ ChromeStorageImpl::ChromeStorageImpl(WriteablePrefStore* store)
ChromeStorageImpl::~ChromeStorageImpl() {}
-void ChromeStorageImpl::Put(const std::string& key, const std::string& data) {
- backing_store_->SetValue(key, new base::StringValue(data));
+void ChromeStorageImpl::Put(const std::string& key,
+ scoped_ptr<std::string> data) {
+ backing_store_->SetValue(key, new base::StringValue(data.Pass()));
}
void ChromeStorageImpl::Get(
@@ -48,10 +49,10 @@ void ChromeStorageImpl::DoGet(
}
const base::Value* value;
- std::string result;
+ const base::StringValue* string_value;
if (backing_store_->GetValue(key, &value) &&
- value->GetAsString(&result)) {
- (*data_ready)(true, key, result);
+ value->GetAsStringValue(&string_value)) {
+ (*data_ready)(true, key, string_value->value());
} else {
(*data_ready)(false, key, std::string());
}

Powered by Google App Engine
This is Rietveld 408576698