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

Unified Diff: rlz/chromeos/lib/rlz_value_store_chromeos.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 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 | « rlz/chromeos/lib/rlz_value_store_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rlz/chromeos/lib/rlz_value_store_chromeos.cc
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.cc b/rlz/chromeos/lib/rlz_value_store_chromeos.cc
index 9f07b75a669e304d2cc03456835a54dbf0e81ed2..84167aa6a08c0cfd5cae6d8d51d763f2d57e1252 100644
--- a/rlz/chromeos/lib/rlz_value_store_chromeos.cc
+++ b/rlz/chromeos/lib/rlz_value_store_chromeos.cc
@@ -10,6 +10,7 @@
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -147,7 +148,7 @@ bool RlzValueStoreChromeOS::AddProductEvent(Product product,
const char* event_rlz) {
DCHECK(CalledOnValidThread());
return AddValueToList(GetKeyName(kProductEventKey, product),
- new base::StringValue(event_rlz));
+ base::MakeUnique<base::StringValue>(event_rlz));
}
bool RlzValueStoreChromeOS::ReadProductEvents(
@@ -184,7 +185,7 @@ bool RlzValueStoreChromeOS::AddStatefulEvent(Product product,
const char* event_rlz) {
DCHECK(CalledOnValidThread());
return AddValueToList(GetKeyName(kStatefulEventKey, product),
- new base::StringValue(event_rlz));
+ base::MakeUnique<base::StringValue>(event_rlz));
}
bool RlzValueStoreChromeOS::IsStatefulEvent(Product product,
@@ -243,13 +244,13 @@ void RlzValueStoreChromeOS::WriteStore() {
}
bool RlzValueStoreChromeOS::AddValueToList(const std::string& list_name,
- base::Value* value) {
+ std::unique_ptr<base::Value> value) {
base::ListValue* list_value = NULL;
if (!rlz_store_->GetList(list_name, &list_value)) {
list_value = new base::ListValue;
rlz_store_->Set(list_name, list_value);
}
- list_value->AppendIfNotPresent(value);
+ list_value->AppendIfNotPresent(std::move(value));
return true;
}
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698