| Index: sync/engine/sync_scheduler_impl.cc
|
| diff --git a/sync/engine/sync_scheduler.cc b/sync/engine/sync_scheduler_impl.cc
|
| similarity index 88%
|
| copy from sync/engine/sync_scheduler.cc
|
| copy to sync/engine/sync_scheduler_impl.cc
|
| index 04b30f0d1028bd1a845cc11c3b0a64d441ddd8b2..289e189cf4c9b9a5c0a2d1ff05de0d27a15bf3f5 100644
|
| --- a/sync/engine/sync_scheduler.cc
|
| +++ b/sync/engine/sync_scheduler_impl.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "sync/engine/sync_scheduler.h"
|
| +#include "sync/engine/sync_scheduler_impl.h"
|
|
|
| #include <algorithm>
|
| #include <cstring>
|
| @@ -83,19 +83,19 @@ ConfigurationParams::ConfigurationParams(
|
| }
|
| ConfigurationParams::~ConfigurationParams() {}
|
|
|
| -SyncScheduler::DelayProvider::DelayProvider() {}
|
| -SyncScheduler::DelayProvider::~DelayProvider() {}
|
| +SyncSchedulerImpl::DelayProvider::DelayProvider() {}
|
| +SyncSchedulerImpl::DelayProvider::~DelayProvider() {}
|
|
|
| -SyncScheduler::WaitInterval::WaitInterval()
|
| +SyncSchedulerImpl::WaitInterval::WaitInterval()
|
| : mode(UNKNOWN),
|
| had_nudge(false) {
|
| }
|
|
|
| -SyncScheduler::WaitInterval::~WaitInterval() {}
|
| +SyncSchedulerImpl::WaitInterval::~WaitInterval() {}
|
|
|
| #define ENUM_CASE(x) case x: return #x; break;
|
|
|
| -const char* SyncScheduler::WaitInterval::GetModeString(Mode mode) {
|
| +const char* SyncSchedulerImpl::WaitInterval::GetModeString(Mode mode) {
|
| switch (mode) {
|
| ENUM_CASE(UNKNOWN);
|
| ENUM_CASE(EXPONENTIAL_BACKOFF);
|
| @@ -105,14 +105,14 @@ const char* SyncScheduler::WaitInterval::GetModeString(Mode mode) {
|
| return "";
|
| }
|
|
|
| -SyncScheduler::SyncSessionJob::SyncSessionJob()
|
| +SyncSchedulerImpl::SyncSessionJob::SyncSessionJob()
|
| : purpose(UNKNOWN),
|
| is_canary_job(false) {
|
| }
|
|
|
| -SyncScheduler::SyncSessionJob::~SyncSessionJob() {}
|
| +SyncSchedulerImpl::SyncSessionJob::~SyncSessionJob() {}
|
|
|
| -SyncScheduler::SyncSessionJob::SyncSessionJob(SyncSessionJobPurpose purpose,
|
| +SyncSchedulerImpl::SyncSessionJob::SyncSessionJob(SyncSessionJobPurpose purpose,
|
| base::TimeTicks start,
|
| linked_ptr<sessions::SyncSession> session,
|
| bool is_canary_job,
|
| @@ -126,8 +126,8 @@ SyncScheduler::SyncSessionJob::SyncSessionJob(SyncSessionJobPurpose purpose,
|
| from_here(from_here) {
|
| }
|
|
|
| -const char* SyncScheduler::SyncSessionJob::GetPurposeString(
|
| - SyncScheduler::SyncSessionJob::SyncSessionJobPurpose purpose) {
|
| +const char* SyncSchedulerImpl::SyncSessionJob::GetPurposeString(
|
| + SyncSchedulerImpl::SyncSessionJob::SyncSessionJobPurpose purpose) {
|
| switch (purpose) {
|
| ENUM_CASE(UNKNOWN);
|
| ENUM_CASE(POLL);
|
| @@ -139,9 +139,9 @@ const char* SyncScheduler::SyncSessionJob::GetPurposeString(
|
| return "";
|
| }
|
|
|
| -TimeDelta SyncScheduler::DelayProvider::GetDelay(
|
| +TimeDelta SyncSchedulerImpl::DelayProvider::GetDelay(
|
| const base::TimeDelta& last_delay) {
|
| - return SyncScheduler::GetRecommendedDelay(last_delay);
|
| + return SyncSchedulerImpl::GetRecommendedDelay(last_delay);
|
| }
|
|
|
| GetUpdatesCallerInfo::GetUpdatesSource GetUpdatesFromNudgeSource(
|
| @@ -163,7 +163,7 @@ GetUpdatesCallerInfo::GetUpdatesSource GetUpdatesFromNudgeSource(
|
| }
|
| }
|
|
|
| -SyncScheduler::WaitInterval::WaitInterval(Mode mode, TimeDelta length)
|
| +SyncSchedulerImpl::WaitInterval::WaitInterval(Mode mode, TimeDelta length)
|
| : mode(mode), had_nudge(false), length(length) { }
|
|
|
| // Helper macros to log with the syncer thread name; useful when there
|
| @@ -195,9 +195,9 @@ bool IsConfigRelatedUpdateSourceValue(
|
|
|
| } // namespace
|
|
|
| -SyncScheduler::SyncScheduler(const std::string& name,
|
| - sessions::SyncSessionContext* context,
|
| - Syncer* syncer)
|
| +SyncSchedulerImpl::SyncSchedulerImpl(const std::string& name,
|
| + sessions::SyncSessionContext* context,
|
| + Syncer* syncer)
|
| : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
|
| weak_ptr_factory_for_weak_handle_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
|
| weak_handle_this_(MakeWeakHandle(
|
| @@ -221,12 +221,12 @@ SyncScheduler::SyncScheduler(const std::string& name,
|
| DCHECK(sync_loop_);
|
| }
|
|
|
| -SyncScheduler::~SyncScheduler() {
|
| +SyncSchedulerImpl::~SyncSchedulerImpl() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| StopImpl(base::Closure());
|
| }
|
|
|
| -void SyncScheduler::OnCredentialsUpdated() {
|
| +void SyncSchedulerImpl::OnCredentialsUpdated() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
|
|
| // TODO(lipalani): crbug.com/106262. One issue here is that if after
|
| @@ -240,7 +240,7 @@ void SyncScheduler::OnCredentialsUpdated() {
|
| }
|
| }
|
|
|
| -void SyncScheduler::OnConnectionStatusChange() {
|
| +void SyncSchedulerImpl::OnConnectionStatusChange() {
|
| if (HttpResponse::CONNECTION_UNAVAILABLE == connection_code_) {
|
| // Optimistically assume that the connection is fixed and try
|
| // connecting.
|
| @@ -248,15 +248,15 @@ void SyncScheduler::OnConnectionStatusChange() {
|
| }
|
| }
|
|
|
| -void SyncScheduler::OnServerConnectionErrorFixed() {
|
| +void SyncSchedulerImpl::OnServerConnectionErrorFixed() {
|
| connection_code_ = HttpResponse::SERVER_CONNECTION_OK;
|
| PostTask(FROM_HERE, "DoCanaryJob",
|
| - base::Bind(&SyncScheduler::DoCanaryJob,
|
| + base::Bind(&SyncSchedulerImpl::DoCanaryJob,
|
| weak_ptr_factory_.GetWeakPtr()));
|
|
|
| }
|
|
|
| -void SyncScheduler::UpdateServerConnectionManagerStatus(
|
| +void SyncSchedulerImpl::UpdateServerConnectionManagerStatus(
|
| HttpResponse::ServerConnectionCode code) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SDVLOG(2) << "New server connection code: "
|
| @@ -265,7 +265,7 @@ void SyncScheduler::UpdateServerConnectionManagerStatus(
|
| connection_code_ = code;
|
| }
|
|
|
| -void SyncScheduler::Start(Mode mode) {
|
| +void SyncSchedulerImpl::Start(Mode mode) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| std::string thread_name = MessageLoop::current()->thread_name();
|
| if (thread_name.empty())
|
| @@ -290,7 +290,7 @@ void SyncScheduler::Start(Mode mode) {
|
| }
|
| }
|
|
|
| -void SyncScheduler::SendInitialSnapshot() {
|
| +void SyncSchedulerImpl::SendInitialSnapshot() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| scoped_ptr<SyncSession> dummy(new SyncSession(session_context_, this,
|
| SyncSourceInfo(), ModelSafeRoutingInfo(),
|
| @@ -331,7 +331,8 @@ void BuildModelSafeParams(
|
|
|
| } // namespace.
|
|
|
| -bool SyncScheduler::ScheduleConfiguration(const ConfigurationParams& params) {
|
| +bool SyncSchedulerImpl::ScheduleConfiguration(
|
| + const ConfigurationParams& params) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK(IsConfigRelatedUpdateSourceValue(params.source));
|
| DCHECK_EQ(CONFIGURATION_MODE, mode_);
|
| @@ -406,7 +407,8 @@ bool SyncScheduler::ScheduleConfiguration(const ConfigurationParams& params) {
|
| return true;
|
| }
|
|
|
| -SyncScheduler::JobProcessDecision SyncScheduler::DecideWhileInWaitInterval(
|
| +SyncSchedulerImpl::JobProcessDecision
|
| +SyncSchedulerImpl::DecideWhileInWaitInterval(
|
| const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK(wait_interval_.get());
|
| @@ -440,7 +442,7 @@ SyncScheduler::JobProcessDecision SyncScheduler::DecideWhileInWaitInterval(
|
| return job.is_canary_job ? CONTINUE : SAVE;
|
| }
|
|
|
| -SyncScheduler::JobProcessDecision SyncScheduler::DecideOnJob(
|
| +SyncSchedulerImpl::JobProcessDecision SyncSchedulerImpl::DecideOnJob(
|
| const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| if (job.purpose == SyncSessionJob::CLEANUP_DISABLED_TYPES)
|
| @@ -492,7 +494,7 @@ SyncScheduler::JobProcessDecision SyncScheduler::DecideOnJob(
|
| return job.purpose == SyncSessionJob::NUDGE ? SAVE : DROP;
|
| }
|
|
|
| -void SyncScheduler::InitOrCoalescePendingJob(const SyncSessionJob& job) {
|
| +void SyncSchedulerImpl::InitOrCoalescePendingJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK(job.purpose != SyncSessionJob::CONFIGURATION);
|
| if (pending_nudge_.get() == NULL) {
|
| @@ -517,7 +519,7 @@ void SyncScheduler::InitOrCoalescePendingJob(const SyncSessionJob& job) {
|
| // location of the first caller.
|
| }
|
|
|
| -bool SyncScheduler::ShouldRunJob(const SyncSessionJob& job) {
|
| +bool SyncSchedulerImpl::ShouldRunJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK(started_);
|
|
|
| @@ -536,7 +538,7 @@ bool SyncScheduler::ShouldRunJob(const SyncSessionJob& job) {
|
| return false;
|
| }
|
|
|
| -void SyncScheduler::SaveJob(const SyncSessionJob& job) {
|
| +void SyncSchedulerImpl::SaveJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| // TODO(sync): Should we also check that job.purpose !=
|
| // CLEANUP_DISABLED_TYPES? (See http://crbug.com/90868.)
|
| @@ -575,7 +577,7 @@ struct ModelSafeWorkerGroupIs {
|
| ModelSafeGroup group;
|
| };
|
|
|
| -void SyncScheduler::ScheduleNudgeAsync(
|
| +void SyncSchedulerImpl::ScheduleNudgeAsync(
|
| const TimeDelta& delay,
|
| NudgeSource source, ModelTypeSet types,
|
| const tracked_objects::Location& nudge_location) {
|
| @@ -587,14 +589,14 @@ void SyncScheduler::ScheduleNudgeAsync(
|
|
|
| ModelTypePayloadMap types_with_payloads =
|
| syncer::ModelTypePayloadMapFromEnumSet(types, std::string());
|
| - SyncScheduler::ScheduleNudgeImpl(delay,
|
| - GetUpdatesFromNudgeSource(source),
|
| - types_with_payloads,
|
| - false,
|
| - nudge_location);
|
| + SyncSchedulerImpl::ScheduleNudgeImpl(delay,
|
| + GetUpdatesFromNudgeSource(source),
|
| + types_with_payloads,
|
| + false,
|
| + nudge_location);
|
| }
|
|
|
| -void SyncScheduler::ScheduleNudgeWithPayloadsAsync(
|
| +void SyncSchedulerImpl::ScheduleNudgeWithPayloadsAsync(
|
| const TimeDelta& delay,
|
| NudgeSource source, const ModelTypePayloadMap& types_with_payloads,
|
| const tracked_objects::Location& nudge_location) {
|
| @@ -605,14 +607,14 @@ void SyncScheduler::ScheduleNudgeWithPayloadsAsync(
|
| << "payloads "
|
| << syncer::ModelTypePayloadMapToString(types_with_payloads);
|
|
|
| - SyncScheduler::ScheduleNudgeImpl(delay,
|
| - GetUpdatesFromNudgeSource(source),
|
| - types_with_payloads,
|
| - false,
|
| - nudge_location);
|
| + SyncSchedulerImpl::ScheduleNudgeImpl(delay,
|
| + GetUpdatesFromNudgeSource(source),
|
| + types_with_payloads,
|
| + false,
|
| + nudge_location);
|
| }
|
|
|
| -void SyncScheduler::ScheduleNudgeImpl(
|
| +void SyncSchedulerImpl::ScheduleNudgeImpl(
|
| const TimeDelta& delay,
|
| GetUpdatesCallerInfo::GetUpdatesSource source,
|
| const ModelTypePayloadMap& types_with_payloads,
|
| @@ -663,7 +665,7 @@ void SyncScheduler::ScheduleNudgeImpl(
|
| ScheduleSyncSessionJob(job);
|
| }
|
|
|
| -const char* SyncScheduler::GetModeString(SyncScheduler::Mode mode) {
|
| +const char* SyncSchedulerImpl::GetModeString(SyncScheduler::Mode mode) {
|
| switch (mode) {
|
| ENUM_CASE(CONFIGURATION_MODE);
|
| ENUM_CASE(NORMAL_MODE);
|
| @@ -671,8 +673,8 @@ const char* SyncScheduler::GetModeString(SyncScheduler::Mode mode) {
|
| return "";
|
| }
|
|
|
| -const char* SyncScheduler::GetDecisionString(
|
| - SyncScheduler::JobProcessDecision mode) {
|
| +const char* SyncSchedulerImpl::GetDecisionString(
|
| + SyncSchedulerImpl::JobProcessDecision mode) {
|
| switch (mode) {
|
| ENUM_CASE(CONTINUE);
|
| ENUM_CASE(SAVE);
|
| @@ -682,7 +684,7 @@ const char* SyncScheduler::GetDecisionString(
|
| }
|
|
|
| // static
|
| -void SyncScheduler::SetSyncerStepsForPurpose(
|
| +void SyncSchedulerImpl::SetSyncerStepsForPurpose(
|
| SyncSessionJob::SyncSessionJobPurpose purpose,
|
| SyncerStep* start,
|
| SyncerStep* end) {
|
| @@ -708,7 +710,7 @@ void SyncScheduler::SetSyncerStepsForPurpose(
|
| }
|
| }
|
|
|
| -void SyncScheduler::PostTask(
|
| +void SyncSchedulerImpl::PostTask(
|
| const tracked_objects::Location& from_here,
|
| const char* name, const base::Closure& task) {
|
| SDVLOG_LOC(from_here, 3) << "Posting " << name << " task";
|
| @@ -720,7 +722,7 @@ void SyncScheduler::PostTask(
|
| sync_loop_->PostTask(from_here, task);
|
| }
|
|
|
| -void SyncScheduler::PostDelayedTask(
|
| +void SyncSchedulerImpl::PostDelayedTask(
|
| const tracked_objects::Location& from_here,
|
| const char* name, const base::Closure& task, base::TimeDelta delay) {
|
| SDVLOG_LOC(from_here, 3) << "Posting " << name << " task with "
|
| @@ -733,7 +735,7 @@ void SyncScheduler::PostDelayedTask(
|
| sync_loop_->PostDelayedTask(from_here, task, delay);
|
| }
|
|
|
| -void SyncScheduler::ScheduleSyncSessionJob(const SyncSessionJob& job) {
|
| +void SyncSchedulerImpl::ScheduleSyncSessionJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| TimeDelta delay = job.scheduled_start - TimeTicks::Now();
|
| if (delay < TimeDelta::FromMilliseconds(0))
|
| @@ -752,13 +754,13 @@ void SyncScheduler::ScheduleSyncSessionJob(const SyncSessionJob& job) {
|
| pending_nudge_.reset(new SyncSessionJob(job));
|
| }
|
| PostDelayedTask(job.from_here, "DoSyncSessionJob",
|
| - base::Bind(&SyncScheduler::DoSyncSessionJob,
|
| + base::Bind(&SyncSchedulerImpl::DoSyncSessionJob,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| job),
|
| delay);
|
| }
|
|
|
| -void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
|
| +void SyncSchedulerImpl::DoSyncSessionJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| if (!ShouldRunJob(job)) {
|
| SLOG(WARNING)
|
| @@ -804,7 +806,7 @@ void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
|
| FinishSyncSessionJob(job);
|
| }
|
|
|
| -void SyncScheduler::UpdateCarryoverSessionState(
|
| +void SyncSchedulerImpl::UpdateCarryoverSessionState(
|
| const SyncSessionJob& old_job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| if (old_job.purpose == SyncSessionJob::CONFIGURATION) {
|
| @@ -825,7 +827,7 @@ void SyncScheduler::UpdateCarryoverSessionState(
|
| }
|
| }
|
|
|
| -void SyncScheduler::FinishSyncSessionJob(const SyncSessionJob& job) {
|
| +void SyncSchedulerImpl::FinishSyncSessionJob(const SyncSessionJob& job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| // Update timing information for how often datatypes are triggering nudges.
|
| base::TimeTicks now = TimeTicks::Now();
|
| @@ -872,7 +874,7 @@ void SyncScheduler::FinishSyncSessionJob(const SyncSessionJob& job) {
|
| ScheduleNextSync(job);
|
| }
|
|
|
| -void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) {
|
| +void SyncSchedulerImpl::ScheduleNextSync(const SyncSessionJob& old_job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK(!old_job.session->HasMoreToSync());
|
|
|
| @@ -920,7 +922,7 @@ void SyncScheduler::ScheduleNextSync(const SyncSessionJob& old_job) {
|
| }
|
| }
|
|
|
| -void SyncScheduler::AdjustPolling(const SyncSessionJob* old_job) {
|
| +void SyncSchedulerImpl::AdjustPolling(const SyncSessionJob* old_job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
|
|
| TimeDelta poll = (!session_context_->notifications_enabled()) ?
|
| @@ -937,17 +939,18 @@ void SyncScheduler::AdjustPolling(const SyncSessionJob* old_job) {
|
|
|
| // Adjust poll rate.
|
| poll_timer_.Stop();
|
| - poll_timer_.Start(FROM_HERE, poll, this, &SyncScheduler::PollTimerCallback);
|
| + poll_timer_.Start(FROM_HERE, poll, this,
|
| + &SyncSchedulerImpl::PollTimerCallback);
|
| }
|
|
|
| -void SyncScheduler::RestartWaiting() {
|
| +void SyncSchedulerImpl::RestartWaiting() {
|
| CHECK(wait_interval_.get());
|
| wait_interval_->timer.Stop();
|
| wait_interval_->timer.Start(FROM_HERE, wait_interval_->length,
|
| - this, &SyncScheduler::DoCanaryJob);
|
| + this, &SyncSchedulerImpl::DoCanaryJob);
|
| }
|
|
|
| -void SyncScheduler::HandleContinuationError(
|
| +void SyncSchedulerImpl::HandleContinuationError(
|
| const SyncSessionJob& old_job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| if (DCHECK_IS_ON()) {
|
| @@ -990,7 +993,7 @@ void SyncScheduler::HandleContinuationError(
|
| }
|
|
|
| // static
|
| -TimeDelta SyncScheduler::GetRecommendedDelay(const TimeDelta& last_delay) {
|
| +TimeDelta SyncSchedulerImpl::GetRecommendedDelay(const TimeDelta& last_delay) {
|
| if (last_delay.InSeconds() >= kMaxBackoffSeconds)
|
| return TimeDelta::FromSeconds(kMaxBackoffSeconds);
|
|
|
| @@ -1013,16 +1016,16 @@ TimeDelta SyncScheduler::GetRecommendedDelay(const TimeDelta& last_delay) {
|
| return TimeDelta::FromSeconds(backoff_s);
|
| }
|
|
|
| -void SyncScheduler::RequestStop(const base::Closure& callback) {
|
| +void SyncSchedulerImpl::RequestStop(const base::Closure& callback) {
|
| syncer_->RequestEarlyExit(); // Safe to call from any thread.
|
| DCHECK(weak_handle_this_.IsInitialized());
|
| SDVLOG(3) << "Posting StopImpl";
|
| weak_handle_this_.Call(FROM_HERE,
|
| - &SyncScheduler::StopImpl,
|
| + &SyncSchedulerImpl::StopImpl,
|
| callback);
|
| }
|
|
|
| -void SyncScheduler::StopImpl(const base::Closure& callback) {
|
| +void SyncSchedulerImpl::StopImpl(const base::Closure& callback) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SDVLOG(2) << "StopImpl called";
|
|
|
| @@ -1037,13 +1040,13 @@ void SyncScheduler::StopImpl(const base::Closure& callback) {
|
| callback.Run();
|
| }
|
|
|
| -void SyncScheduler::DoCanaryJob() {
|
| +void SyncSchedulerImpl::DoCanaryJob() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SDVLOG(2) << "Do canary job";
|
| DoPendingJobIfPossible(true);
|
| }
|
|
|
| -void SyncScheduler::DoPendingJobIfPossible(bool is_canary_job) {
|
| +void SyncSchedulerImpl::DoPendingJobIfPossible(bool is_canary_job) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SyncSessionJob* job_to_execute = NULL;
|
| if (mode_ == CONFIGURATION_MODE && wait_interval_.get()
|
| @@ -1075,7 +1078,8 @@ void SyncScheduler::DoPendingJobIfPossible(bool is_canary_job) {
|
| }
|
| }
|
|
|
| -SyncSession* SyncScheduler::CreateSyncSession(const SyncSourceInfo& source) {
|
| +SyncSession* SyncSchedulerImpl::CreateSyncSession(
|
| + const SyncSourceInfo& source) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DVLOG(2) << "Creating sync session with routes "
|
| << ModelSafeRoutingInfoToString(session_context_->routing_info());
|
| @@ -1087,7 +1091,7 @@ SyncSession* SyncScheduler::CreateSyncSession(const SyncSourceInfo& source) {
|
| return session;
|
| }
|
|
|
| -void SyncScheduler::PollTimerCallback() {
|
| +void SyncSchedulerImpl::PollTimerCallback() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| ModelSafeRoutingInfo r;
|
| ModelTypePayloadMap types_with_payloads =
|
| @@ -1104,7 +1108,7 @@ void SyncScheduler::PollTimerCallback() {
|
| ScheduleSyncSessionJob(job);
|
| }
|
|
|
| -void SyncScheduler::Unthrottle() {
|
| +void SyncSchedulerImpl::Unthrottle() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| DCHECK_EQ(WaitInterval::THROTTLED, wait_interval_->mode);
|
| SDVLOG(2) << "Unthrottled.";
|
| @@ -1112,57 +1116,58 @@ void SyncScheduler::Unthrottle() {
|
| wait_interval_.reset();
|
| }
|
|
|
| -void SyncScheduler::Notify(SyncEngineEvent::EventCause cause) {
|
| +void SyncSchedulerImpl::Notify(SyncEngineEvent::EventCause cause) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| session_context_->NotifyListeners(SyncEngineEvent(cause));
|
| }
|
|
|
| -bool SyncScheduler::IsBackingOff() const {
|
| +bool SyncSchedulerImpl::IsBackingOff() const {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| return wait_interval_.get() && wait_interval_->mode ==
|
| WaitInterval::EXPONENTIAL_BACKOFF;
|
| }
|
|
|
| -void SyncScheduler::OnSilencedUntil(const base::TimeTicks& silenced_until) {
|
| +void SyncSchedulerImpl::OnSilencedUntil(
|
| + const base::TimeTicks& silenced_until) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| wait_interval_.reset(new WaitInterval(WaitInterval::THROTTLED,
|
| silenced_until - TimeTicks::Now()));
|
| wait_interval_->timer.Start(FROM_HERE, wait_interval_->length, this,
|
| - &SyncScheduler::Unthrottle);
|
| + &SyncSchedulerImpl::Unthrottle);
|
| }
|
|
|
| -bool SyncScheduler::IsSyncingCurrentlySilenced() {
|
| +bool SyncSchedulerImpl::IsSyncingCurrentlySilenced() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| return wait_interval_.get() && wait_interval_->mode ==
|
| WaitInterval::THROTTLED;
|
| }
|
|
|
| -void SyncScheduler::OnReceivedShortPollIntervalUpdate(
|
| +void SyncSchedulerImpl::OnReceivedShortPollIntervalUpdate(
|
| const base::TimeDelta& new_interval) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| syncer_short_poll_interval_seconds_ = new_interval;
|
| }
|
|
|
| -void SyncScheduler::OnReceivedLongPollIntervalUpdate(
|
| +void SyncSchedulerImpl::OnReceivedLongPollIntervalUpdate(
|
| const base::TimeDelta& new_interval) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| syncer_long_poll_interval_seconds_ = new_interval;
|
| }
|
|
|
| -void SyncScheduler::OnReceivedSessionsCommitDelay(
|
| +void SyncSchedulerImpl::OnReceivedSessionsCommitDelay(
|
| const base::TimeDelta& new_delay) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| sessions_commit_delay_ = new_delay;
|
| }
|
|
|
| -void SyncScheduler::OnShouldStopSyncingPermanently() {
|
| +void SyncSchedulerImpl::OnShouldStopSyncingPermanently() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SDVLOG(2) << "OnShouldStopSyncingPermanently";
|
| syncer_->RequestEarlyExit(); // Thread-safe.
|
| Notify(SyncEngineEvent::STOP_SYNCING_PERMANENTLY);
|
| }
|
|
|
| -void SyncScheduler::OnActionableError(
|
| +void SyncSchedulerImpl::OnActionableError(
|
| const sessions::SyncSessionSnapshot& snap) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| SDVLOG(2) << "OnActionableError";
|
| @@ -1171,7 +1176,7 @@ void SyncScheduler::OnActionableError(
|
| session_context_->NotifyListeners(event);
|
| }
|
|
|
| -void SyncScheduler::OnSyncProtocolError(
|
| +void SyncSchedulerImpl::OnSyncProtocolError(
|
| const sessions::SyncSessionSnapshot& snapshot) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| if (ShouldRequestEarlyExit(
|
| @@ -1183,12 +1188,12 @@ void SyncScheduler::OnSyncProtocolError(
|
| OnActionableError(snapshot);
|
| }
|
|
|
| -void SyncScheduler::set_notifications_enabled(bool notifications_enabled) {
|
| +void SyncSchedulerImpl::SetNotificationsEnabled(bool notifications_enabled) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| session_context_->set_notifications_enabled(notifications_enabled);
|
| }
|
|
|
| -base::TimeDelta SyncScheduler::sessions_commit_delay() const {
|
| +base::TimeDelta SyncSchedulerImpl::GetSessionsCommitDelay() const {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| return sessions_commit_delay_;
|
| }
|
|
|