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

Unified Diff: components/sync/engine_impl/sync_scheduler_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 side-by-side diff with in-line comments
Download patch
Index: components/sync/engine_impl/sync_scheduler_impl.cc
diff --git a/components/sync/engine_impl/sync_scheduler_impl.cc b/components/sync/engine_impl/sync_scheduler_impl.cc
index 204f89079fa33bbf3489c2ab70c57dc7984a0938..fb628db344420853725da42ba6fafd40194d4f1d 100644
--- a/components/sync/engine_impl/sync_scheduler_impl.cc
+++ b/components/sync/engine_impl/sync_scheduler_impl.cc
@@ -12,6 +12,7 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -324,7 +325,7 @@ void SyncSchedulerImpl::ScheduleConfiguration(
// Only reconfigure if we have types to download.
if (!params.types_to_download.Empty()) {
- pending_configure_params_.reset(new ConfigurationParams(params));
+ pending_configure_params_ = base::MakeUnique<ConfigurationParams>(params);
TrySyncCycleJob();
} else {
SDVLOG(2) << "No change in routing info, calling ready task directly.";
@@ -338,7 +339,7 @@ void SyncSchedulerImpl::ScheduleClearServerData(const ClearParams& params) {
DCHECK(!pending_configure_params_);
DCHECK(!params.report_success_task.is_null());
CHECK(started_) << "Scheduler must be running to clear.";
- pending_clear_params_.reset(new ClearParams(params));
+ pending_clear_params_ = base::MakeUnique<ClearParams>(params);
TrySyncCycleJob();
}
@@ -583,15 +584,15 @@ void SyncSchedulerImpl::HandleFailure(
// Setup our backoff if this is our first such failure.
TimeDelta length = delay_provider_->GetDelay(
delay_provider_->GetInitialDelay(model_neutral_state));
- wait_interval_.reset(
- new WaitInterval(WaitInterval::EXPONENTIAL_BACKOFF, length));
+ wait_interval_ = base::MakeUnique<WaitInterval>(
+ WaitInterval::EXPONENTIAL_BACKOFF, length);
SDVLOG(2) << "Sync cycle failed. Will back off for "
<< wait_interval_->length.InMilliseconds() << "ms.";
} else {
// Increase our backoff interval and schedule another retry.
TimeDelta length = delay_provider_->GetDelay(wait_interval_->length);
- wait_interval_.reset(
- new WaitInterval(WaitInterval::EXPONENTIAL_BACKOFF, length));
+ wait_interval_ = base::MakeUnique<WaitInterval>(
+ WaitInterval::EXPONENTIAL_BACKOFF, length);
SDVLOG(2) << "Sync cycle failed. Will back off for "
<< wait_interval_->length.InMilliseconds() << "ms.";
}
@@ -769,8 +770,8 @@ void SyncSchedulerImpl::TrySyncCycleJobImpl() {
// been cleared, then we should increase our backoff interval and schedule
// another retry.
TimeDelta length = delay_provider_->GetDelay(wait_interval_->length);
- wait_interval_.reset(
- new WaitInterval(WaitInterval::EXPONENTIAL_BACKOFF, length));
+ wait_interval_ = base::MakeUnique<WaitInterval>(
+ WaitInterval::EXPONENTIAL_BACKOFF, length);
SDVLOG(2) << "Sync cycle failed. Will back off for "
<< wait_interval_->length.InMilliseconds() << "ms.";
RestartWaiting();
@@ -860,8 +861,8 @@ bool SyncSchedulerImpl::IsBackingOff() const {
void SyncSchedulerImpl::OnThrottled(const base::TimeDelta& throttle_duration) {
DCHECK(CalledOnValidThread());
- wait_interval_.reset(
- new WaitInterval(WaitInterval::THROTTLED, throttle_duration));
+ wait_interval_ = base::MakeUnique<WaitInterval>(WaitInterval::THROTTLED,
+ throttle_duration);
NotifyRetryTime(base::Time::Now() + wait_interval_->length);
NotifyThrottledTypesChanged(ModelTypeSet::All());
}
« no previous file with comments | « components/sync/engine_impl/sync_manager_impl.cc ('k') | components/sync/engine_impl/sync_scheduler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698