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

Unified Diff: components/sync/driver/generic_change_processor.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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: components/sync/driver/generic_change_processor.cc
diff --git a/components/sync/driver/generic_change_processor.cc b/components/sync/driver/generic_change_processor.cc
index bb2d4bd5636a65796d8ed5e6086e383edb5bb30e..a2d3506bb6d737356146fb867828670a4dd120ee 100644
--- a/components/sync/driver/generic_change_processor.cc
+++ b/components/sync/driver/generic_change_processor.cc
@@ -10,6 +10,7 @@
#include <utility>
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -130,8 +131,9 @@ GenericChangeProcessor::GenericChangeProcessor(
sync_client->GetSyncApiComponentFactory()->CreateAttachmentService(
std::move(attachment_store), *user_share, store_birthday, type,
this);
- attachment_service_weak_ptr_factory_.reset(
- new base::WeakPtrFactory<AttachmentService>(attachment_service_.get()));
+ attachment_service_weak_ptr_factory_ =
+ base::MakeUnique<base::WeakPtrFactory<AttachmentService>>(
+ attachment_service_.get());
attachment_service_proxy_ = AttachmentServiceProxy(
base::ThreadTaskRunnerHandle::Get(),
attachment_service_weak_ptr_factory_->GetWeakPtr());
@@ -159,7 +161,7 @@ void GenericChangeProcessor::ApplyChangesFromSyncModel(
std::unique_ptr<sync_pb::EntitySpecifics> specifics;
if (it->specifics.has_password()) {
DCHECK(it->extra.get());
- specifics.reset(new sync_pb::EntitySpecifics(it->specifics));
+ specifics = base::MakeUnique<sync_pb::EntitySpecifics>(it->specifics);
specifics->mutable_password()
->mutable_client_only_encrypted_data()
->CopyFrom(it->extra->unencrypted());

Powered by Google App Engine
This is Rietveld 408576698