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

Side by Side Diff: components/sync/device_info/local_device_info_provider_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/device_info/local_device_info_provider_impl.h" 5 #include "components/sync/device_info/local_device_info_provider_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/task_runner.h" 9 #include "base/task_runner.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "components/sync/base/get_session_name.h" 11 #include "components/sync/base/get_session_name.h"
11 #include "components/sync/driver/sync_util.h" 12 #include "components/sync/driver/sync_util.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 namespace { 16 namespace {
16 17
17 sync_pb::SyncEnums::DeviceType GetLocalDeviceType(bool is_tablet) { 18 sync_pb::SyncEnums::DeviceType GetLocalDeviceType(bool is_tablet) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void LocalDeviceInfoProviderImpl::InitializeContinuation( 88 void LocalDeviceInfoProviderImpl::InitializeContinuation(
88 const std::string& guid, 89 const std::string& guid,
89 const std::string& signin_scoped_device_id, 90 const std::string& signin_scoped_device_id,
90 const std::string& session_name) { 91 const std::string& session_name) {
91 DCHECK(CalledOnValidThread()); 92 DCHECK(CalledOnValidThread());
92 if (guid != cache_guid_) { 93 if (guid != cache_guid_) {
93 // Clear() happened before this callback; abort. 94 // Clear() happened before this callback; abort.
94 return; 95 return;
95 } 96 }
96 97
97 local_device_info_.reset( 98 local_device_info_ = base::MakeUnique<DeviceInfo>(
98 new DeviceInfo(guid, session_name, version_, GetSyncUserAgent(), 99 guid, session_name, version_, GetSyncUserAgent(),
99 GetLocalDeviceType(is_tablet_), signin_scoped_device_id)); 100 GetLocalDeviceType(is_tablet_), signin_scoped_device_id);
100 101
101 // Notify observers. 102 // Notify observers.
102 callback_list_.Notify(); 103 callback_list_.Notify();
103 } 104 }
104 105
105 void LocalDeviceInfoProviderImpl::Clear() { 106 void LocalDeviceInfoProviderImpl::Clear() {
106 DCHECK(CalledOnValidThread()); 107 DCHECK(CalledOnValidThread());
107 cache_guid_ = ""; 108 cache_guid_ = "";
108 local_device_info_.reset(); 109 local_device_info_.reset();
109 } 110 }
110 111
111 } // namespace syncer 112 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698