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

Side by Side Diff: components/proximity_auth/cryptauth/sync_scheduler_impl.cc

Issue 2250023005: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/proximity_auth/cryptauth/sync_scheduler_impl.h" 5 #include "components/proximity_auth/cryptauth/sync_scheduler_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 sync_state_ = SyncState::SYNC_IN_PROGRESS; 106 sync_state_ = SyncState::SYNC_IN_PROGRESS;
107 } else if (strategy_ == Strategy::AGGRESSIVE_RECOVERY) { 107 } else if (strategy_ == Strategy::AGGRESSIVE_RECOVERY) {
108 PA_LOG(INFO) << "Timer fired for aggressive recovery, making request..."; 108 PA_LOG(INFO) << "Timer fired for aggressive recovery, making request...";
109 sync_state_ = SyncState::SYNC_IN_PROGRESS; 109 sync_state_ = SyncState::SYNC_IN_PROGRESS;
110 } else { 110 } else {
111 NOTREACHED(); 111 NOTREACHED();
112 return; 112 return;
113 } 113 }
114 114
115 delegate_->OnSyncRequested( 115 delegate_->OnSyncRequested(
116 base::WrapUnique(new SyncRequest(weak_ptr_factory_.GetWeakPtr()))); 116 base::MakeUnique<SyncRequest>(weak_ptr_factory_.GetWeakPtr()));
117 } 117 }
118 118
119 std::unique_ptr<base::Timer> SyncSchedulerImpl::CreateTimer() { 119 std::unique_ptr<base::Timer> SyncSchedulerImpl::CreateTimer() {
120 bool retain_user_task = false; 120 bool retain_user_task = false;
121 bool is_repeating = false; 121 bool is_repeating = false;
122 return base::WrapUnique(new base::Timer(retain_user_task, is_repeating)); 122 return base::MakeUnique<base::Timer>(retain_user_task, is_repeating);
123 } 123 }
124 124
125 void SyncSchedulerImpl::ScheduleNextSync(const base::TimeDelta& sync_delta) { 125 void SyncSchedulerImpl::ScheduleNextSync(const base::TimeDelta& sync_delta) {
126 if (sync_state_ != SyncState::WAITING_FOR_REFRESH) { 126 if (sync_state_ != SyncState::WAITING_FOR_REFRESH) {
127 PA_LOG(ERROR) << "Unexpected state when scheduling next sync: sync_state=" 127 PA_LOG(ERROR) << "Unexpected state when scheduling next sync: sync_state="
128 << static_cast<int>(sync_state_); 128 << static_cast<int>(sync_state_);
129 return; 129 return;
130 } 130 }
131 131
132 bool is_aggressive_recovery = (strategy_ == Strategy::AGGRESSIVE_RECOVERY); 132 bool is_aggressive_recovery = (strategy_ == Strategy::AGGRESSIVE_RECOVERY);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 base::TimeDelta backoff_period = base_recovery_period_ * backoff_factor; 188 base::TimeDelta backoff_period = base_recovery_period_ * backoff_factor;
189 return backoff_period < refresh_period_ ? backoff_period : refresh_period_; 189 return backoff_period < refresh_period_ ? backoff_period : refresh_period_;
190 } else { 190 } else {
191 PA_LOG(ERROR) << "Error getting period for strategy: " 191 PA_LOG(ERROR) << "Error getting period for strategy: "
192 << static_cast<int>(strategy_); 192 << static_cast<int>(strategy_);
193 return base::TimeDelta(); 193 return base::TimeDelta();
194 } 194 }
195 } 195 }
196 196
197 } // namespace proximity_auth 197 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698