| Index: chrome/browser/sync/engine/sync_scheduler.cc
|
| diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc
|
| index f87d83a003bf2140eb7f83d9a0fa98e624e4f4d3..ff87dcc88a90dd81a5cac1a32b4cd05d3589b0b3 100644
|
| --- a/chrome/browser/sync/engine/sync_scheduler.cc
|
| +++ b/chrome/browser/sync/engine/sync_scheduler.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/rand_util.h"
|
| #include "base/tracked.h"
|
| #include "chrome/browser/sync/engine/syncer.h"
|
| +#include "chrome/browser/sync/protocol/sync.pb.h"
|
| #include "chrome/browser/sync/protocol/proto_enum_conversions.h"
|
| #include "chrome/browser/sync/util/logging.h"
|
|
|
| @@ -262,7 +263,7 @@ SyncScheduler::JobProcessDecision SyncScheduler::DecideWhileInWaitInterval(
|
| return DROP;
|
|
|
| DCHECK(job.purpose == SyncSessionJob::NUDGE ||
|
| - job.purpose == SyncSessionJob::CONFIGURATION);
|
| + job.purpose == SyncSessionJob::CONFIGURATION);
|
| if (wait_interval_->mode == WaitInterval::THROTTLED)
|
| return SAVE;
|
|
|
| @@ -384,6 +385,17 @@ struct ModelSafeWorkerGroupIs {
|
| ModelSafeGroup group;
|
| };
|
|
|
| +void SyncScheduler::CleanupDisabledTypes() {
|
| + DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| + ModelSafeRoutingInfo routes;
|
| + std::vector<ModelSafeWorker*> workers;
|
| + session_context_->registrar()->GetModelSafeRoutingInfo(&routes);
|
| + session_context_->registrar()->GetWorkers(&workers);
|
| + SyncSession session(session_context_.get(), this, SyncSourceInfo(),
|
| + routes, workers);
|
| + syncer_->CleanupDisabledTypes(&session);
|
| +}
|
| +
|
| void SyncScheduler::ScheduleClearUserData() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| PostTask(FROM_HERE, "ScheduleClearUserDataImpl",
|
| @@ -391,6 +403,13 @@ void SyncScheduler::ScheduleClearUserData() {
|
| &SyncScheduler::ScheduleClearUserDataImpl));
|
| }
|
|
|
| +void SyncScheduler::ScheduleCleanupDisabledTypes() {
|
| + DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| + PostTask(FROM_HERE, "ScheduleCleanupDisabledTypes",
|
| + method_factory_.NewRunnableMethod(
|
| + &SyncScheduler::CleanupDisabledTypes));
|
| +}
|
| +
|
| void SyncScheduler::ScheduleNudge(
|
| const TimeDelta& delay,
|
| NudgeSource source, const ModelTypeBitSet& types,
|
| @@ -430,11 +449,9 @@ void SyncScheduler::ScheduleNudgeWithPayloads(
|
|
|
| void SyncScheduler::ScheduleClearUserDataImpl() {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| - SyncSession* session = new SyncSession(session_context_.get(), this,
|
| - SyncSourceInfo(), ModelSafeRoutingInfo(),
|
| - std::vector<ModelSafeWorker*>());
|
| - ScheduleSyncSessionJob(TimeDelta::FromSeconds(0),
|
| - SyncSessionJob::CLEAR_USER_DATA, session, FROM_HERE);
|
| + ScheduleSyncSessionJob(
|
| + TimeDelta::FromSeconds(0), SyncSessionJob::CLEAR_USER_DATA,
|
| + CreateSyncSession(SyncSourceInfo()), FROM_HERE);
|
| }
|
|
|
| void SyncScheduler::ScheduleNudgeImpl(
|
| @@ -452,9 +469,6 @@ void SyncScheduler::ScheduleNudgeImpl(
|
| << syncable::ModelTypePayloadMapToString(types_with_payloads)
|
| << (is_canary_job ? " (canary)" : "");
|
|
|
| - // Note we currently nudge for all types regardless of the ones incurring
|
| - // the nudge. Doing different would throw off some syncer commands like
|
| - // CleanupDisabledTypes. We may want to change this in the future.
|
| SyncSourceInfo info(source, types_with_payloads);
|
|
|
| SyncSession* session(CreateSyncSession(info));
|
| @@ -631,7 +645,6 @@ void SyncScheduler::SetSyncerStepsForPurpose(
|
| SyncSessionJob::SyncSessionJobPurpose purpose,
|
| SyncerStep* start, SyncerStep* end) {
|
| DCHECK_EQ(MessageLoop::current(), sync_loop_);
|
| - *end = SYNCER_END;
|
| switch (purpose) {
|
| case SyncSessionJob::CONFIGURATION:
|
| *start = DOWNLOAD_UPDATES;
|
| @@ -639,13 +652,18 @@ void SyncScheduler::SetSyncerStepsForPurpose(
|
| return;
|
| case SyncSessionJob::CLEAR_USER_DATA:
|
| *start = CLEAR_PRIVATE_DATA;
|
| + *end = CLEAR_PRIVATE_DATA;
|
| return;
|
| case SyncSessionJob::NUDGE:
|
| case SyncSessionJob::POLL:
|
| *start = SYNCER_BEGIN;
|
| + *end = SYNCER_END;
|
| return;
|
| default:
|
| NOTREACHED();
|
| + *start = SYNCER_END;
|
| + *end = SYNCER_END;
|
| + return;
|
| }
|
| }
|
|
|
| @@ -677,7 +695,7 @@ void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
|
| SVLOG(2) << "DoSyncSessionJob with "
|
| << SyncSessionJob::GetPurposeString(job.purpose) << " job";
|
|
|
| - SyncerStep begin(SYNCER_BEGIN);
|
| + SyncerStep begin(SYNCER_END);
|
| SyncerStep end(SYNCER_END);
|
| SetSyncerStepsForPurpose(job.purpose, &begin, &end);
|
|
|
| @@ -691,6 +709,7 @@ void SyncScheduler::DoSyncSessionJob(const SyncSessionJob& job) {
|
| job.session->ResetTransientState();
|
| }
|
| SVLOG(2) << "Done SyncShare looping.";
|
| +
|
| FinishSyncSessionJob(job);
|
| }
|
|
|
|
|