Chromium Code Reviews| Index: chrome/browser/sync/engine/syncer_thread2.cc |
| diff --git a/chrome/browser/sync/engine/syncer_thread2.cc b/chrome/browser/sync/engine/syncer_thread2.cc |
| index e94215e1b5f809ac682d54865f0e2085d812261a..9d198b8afc6c0ac0bed68190bbae1c14224923b1 100644 |
| --- a/chrome/browser/sync/engine/syncer_thread2.cc |
| +++ b/chrome/browser/sync/engine/syncer_thread2.cc |
| @@ -23,37 +23,6 @@ using sync_pb::GetUpdatesCallerInfo; |
| namespace s3 { |
| -struct SyncerThread::WaitInterval { |
| - enum Mode { |
| - // A wait interval whose duration has been affected by exponential |
| - // backoff. |
| - // EXPONENTIAL_BACKOFF intervals are nudge-rate limited to 1 per interval. |
| - EXPONENTIAL_BACKOFF, |
| - // A server-initiated throttled interval. We do not allow any syncing |
| - // during such an interval. |
| - THROTTLED, |
| - }; |
| - Mode mode; |
| - |
| - // This bool is set to true if we have observed a nudge during this |
| - // interval and mode == EXPONENTIAL_BACKOFF. |
| - bool had_nudge; |
| - base::TimeDelta length; |
| - base::OneShotTimer<SyncerThread> timer; |
| - WaitInterval(Mode mode, base::TimeDelta length); |
| -}; |
| - |
| -struct SyncerThread::SyncSessionJob { |
| - SyncSessionJobPurpose purpose; |
| - base::TimeTicks scheduled_start; |
| - linked_ptr<sessions::SyncSession> session; |
| - |
| - // This is the location the nudge came from. used for debugging purpose. |
| - // In case of multiple nudges getting coalesced this stores the first nudge |
| - // that came in. |
| - tracked_objects::Location nudge_location; |
| -}; |
| - |
| SyncerThread::DelayProvider::DelayProvider() {} |
| SyncerThread::DelayProvider::~DelayProvider() {} |
| @@ -62,6 +31,23 @@ TimeDelta SyncerThread::DelayProvider::GetDelay( |
| return SyncerThread::GetRecommendedDelay(last_delay); |
| } |
| +GetUpdatesCallerInfo::GetUpdatesSource GetUpdatesFromNudgeSource( |
| + NudgeSource source) { |
| + switch (source) { |
| + case NUDGE_SOURCE_NOTIFICATION: |
| + return GetUpdatesCallerInfo::NOTIFICATION; |
| + case NUDGE_SOURCE_LOCAL: |
| + return GetUpdatesCallerInfo::LOCAL; |
| + case NUDGE_SOURCE_CONTINUATION: |
| + return GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION; |
| + case NUDGE_SOURCE_UNKNOWN: |
| + return GetUpdatesCallerInfo::UNKNOWN; |
| + default: |
| + NOTREACHED(); |
| + return GetUpdatesCallerInfo::UNKNOWN; |
| + } |
| +} |
| + |
| SyncerThread::WaitInterval::WaitInterval(Mode mode, TimeDelta length) |
| : mode(mode), had_nudge(false), length(length) { } |
| @@ -96,6 +82,7 @@ void SyncerThread::CheckServerConnectionManagerStatus( |
| server_connection_ok_ = false; |
| } else if (HttpResponse::SERVER_CONNECTION_OK == code) { |
| server_connection_ok_ = true; |
| + ExecutePendingJob(); |
| } |
| } |
| @@ -140,74 +127,115 @@ void SyncerThread::StartImpl(Mode mode, |
| AdjustPolling(NULL); // Will kick start poll timer if needed. |
| if (callback.get()) |
| callback->Run(); |
| + |
| + ExecutePendingJob(); |
|
tim (not reviewing)
2011/04/09 23:52:58
this kind of looks out of place. at the very leas
lipalani1
2011/04/12 02:33:00
Done.
|
| } |
| -bool SyncerThread::ShouldRunJob(SyncSessionJobPurpose purpose, |
| - const TimeTicks& scheduled_start) { |
| - DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); |
| +SyncerThread::JobProcessDecision SyncerThread::DecideWhileInWaitInterval( |
| + const SyncSessionJob& job) { |
| - // Check wait interval. |
| - if (wait_interval_.get()) { |
| - // TODO(tim): Consider different handling for CLEAR_USER_DATA (i.e. permit |
| - // when throttled). |
| - if (wait_interval_->mode == WaitInterval::THROTTLED) |
| - return false; |
| + DCHECK(wait_interval_.get()); |
| + DCHECK(job.purpose != CLEAR_USER_DATA); |
|
tim (not reviewing)
2011/04/09 23:52:58
DCHECK_NE
lipalani1
2011/04/12 02:33:00
Done.
|
| - DCHECK_EQ(wait_interval_->mode, WaitInterval::EXPONENTIAL_BACKOFF); |
| - if ((purpose != NUDGE) || wait_interval_->had_nudge) |
| - return false; |
| - } |
| + if (job.purpose == POLL) |
| + return DROP; |
| - // Mode / purpose contract (See 'Mode' enum in header). Don't run jobs that |
| - // were intended for a normal sync if we are in configuration mode, and vice |
| - // versa. |
| - switch (mode_) { |
| - case CONFIGURATION_MODE: |
| - if (purpose != CONFIGURATION) |
| - return false; |
| - break; |
| - case NORMAL_MODE: |
| - if (purpose == CONFIGURATION) |
| - return false; |
| - break; |
| - default: |
| - NOTREACHED() << "Unknown SyncerThread Mode: " << mode_; |
| - return false; |
| + DCHECK(job.purpose == NUDGE || job.purpose == CONFIGURATION); |
| + if (wait_interval_->mode == WaitInterval::THROTTLED) |
| + return SAVE; |
| + |
| + DCHECK_EQ(wait_interval_->mode, WaitInterval::EXPONENTIAL_BACKOFF); |
| + if (job.purpose == NUDGE) { |
| + if (mode_ == CONFIGURATION_MODE) |
| + return SAVE; |
| + |
| + // If we already had one nudge then just drop this nudge. We will retry |
| + // later when the timer runs out. |
| + return wait_interval_->had_nudge ? DROP : CONTINUE; |
| + } else { |
| + // This is a config job. If our timer ran out then continue else save. |
|
tim (not reviewing)
2011/04/09 23:52:58
Saying it's a config job is fine but I'd avoid ref
lipalani1
2011/04/12 02:33:00
Done.
|
| + return job.is_canary_job ? CONTINUE : SAVE; |
| } |
| +} |
| + |
| +SyncerThread::JobProcessDecision SyncerThread::DecideOnJob( |
| + const SyncSessionJob& job) { |
| + if (job.purpose == CLEAR_USER_DATA) |
| + return CONTINUE; |
| + |
| + if (wait_interval_.get()) |
| + return DecideWhileInWaitInterval(job); |
| - // Continuation NUDGE tasks have priority over POLLs because they are the |
| - // only tasks that trigger exponential backoff, so this prevents them from |
| - // being starved from running (e.g. due to a very, very low poll interval, |
| - // such as 0ms). It's rare that this would ever matter in practice. |
| - if (purpose == POLL && (pending_nudge_.get() && |
| - pending_nudge_->session->source().updates_source == |
| - GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION)) { |
| - return false; |
| + if (mode_ == CONFIGURATION_MODE) { |
| + if (job.purpose == NUDGE) { |
|
tim (not reviewing)
2011/04/09 23:52:58
remove the { }s from this inner if as they're 1-li
lipalani1
2011/04/12 02:33:00
Done.
|
| + return SAVE; |
| + } else if (job.purpose == CONFIGURATION) { |
| + return CONTINUE; |
| + } else { |
| + return DROP; |
| + } |
| } |
| - // Freshness condition. |
| - if (purpose == NUDGE && |
| - (scheduled_start < last_sync_session_end_time_)) { |
| - return false; |
| + // We are in normal mode. |
| + DCHECK(mode_ == NORMAL_MODE); |
|
tim (not reviewing)
2011/04/09 23:52:58
DCHECK_EQ
lipalani1
2011/04/12 02:33:00
Done.
|
| + DCHECK(job.purpose != CONFIGURATION); |
|
tim (not reviewing)
2011/04/09 23:52:58
I don't think this should be a dcheck. The mode c
lipalani1
2011/04/12 02:33:00
Not sure I follow this. Let me talk to you today w
|
| + |
| + // Freshness condition |
| + if (job.scheduled_start < last_sync_session_end_time_) |
| + return DROP; |
| + |
| + if (server_connection_ok_) |
| + return CONTINUE; |
| + |
| + return job.purpose == NUDGE ? SAVE : DROP; |
| +} |
| + |
| +void SyncerThread::UpdatePendingJob(const SyncSessionJob& job) { |
|
tim (not reviewing)
2011/04/09 23:52:58
I've looked at the callsites of this function and
lipalani1
2011/04/12 02:33:00
There are 3 callsites. 2 of them(from savejob and
|
| + DCHECK(job.purpose != CONFIGURATION); |
| + if (pending_nudge_.get() == NULL) { |
| + SyncSession* s = job.session.get(); |
| + scoped_ptr<SyncSession> session(new SyncSession(s->context(), |
| + s->delegate(), s->source(), s->routing_info(), s->workers())); |
| + |
| + SyncSessionJob new_job = {NUDGE, job.scheduled_start, |
| + make_linked_ptr(session.release()), false, job.nudge_location}; |
| + pending_nudge_.reset(new SyncSessionJob(new_job)); |
| + |
| + return; |
| } |
| - return server_connection_ok_; |
| + pending_nudge_->session->Coalesce(*(job.session.get())); |
| + pending_nudge_->scheduled_start = job.scheduled_start; |
| + |
| + // Unfortunately the nudge location cannot be modified. So it stores the |
| + // location of the first caller. |
| } |
| -GetUpdatesCallerInfo::GetUpdatesSource GetUpdatesFromNudgeSource( |
| - NudgeSource source) { |
| - switch (source) { |
| - case NUDGE_SOURCE_NOTIFICATION: |
| - return GetUpdatesCallerInfo::NOTIFICATION; |
| - case NUDGE_SOURCE_LOCAL: |
| - return GetUpdatesCallerInfo::LOCAL; |
| - case NUDGE_SOURCE_CONTINUATION: |
| - return GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION; |
| - case NUDGE_SOURCE_UNKNOWN: |
| - return GetUpdatesCallerInfo::UNKNOWN; |
| - default: |
| - NOTREACHED(); |
| - return GetUpdatesCallerInfo::UNKNOWN; |
| +bool SyncerThread::ShouldRunJob(const SyncSessionJob& job) { |
| + JobProcessDecision decision = DecideOnJob(job); |
| + if (decision != SAVE) |
| + return decision == CONTINUE ? true : false; |
|
tim (not reviewing)
2011/04/09 23:52:58
remove the ternary here, it is redundant to decisi
lipalani1
2011/04/12 02:33:00
ha ha ! may be you got confused as I mentioned!!(o
|
| + |
| + DCHECK(job.purpose == NUDGE || job.purpose == CONFIGURATION); |
| + |
| + SaveJob(job); |
| + return false; |
| +} |
| + |
| +void SyncerThread::SaveJob(const SyncSessionJob& job) { |
| + DCHECK(job.purpose != CLEAR_USER_DATA); |
| + if (job.purpose == NUDGE || job.purpose == POLL) { |
|
tim (not reviewing)
2011/04/09 23:52:58
We should never want to save a POLL.
lipalani1
2011/04/12 02:33:00
The case here is when in config but a poll comes i
tim (not reviewing)
2011/04/12 06:09:29
In that case I claim we want to drop the poll. We
lipalani1
2011/04/13 00:07:29
Actually the code was already dropping it!!
On 201
|
| + UpdatePendingJob(job); |
| + } else { |
| + DCHECK(wait_interval_.get()); |
| + DCHECK(mode_ == CONFIGURATION_MODE); |
| + |
| + SyncSession* old = job.session.get(); |
| + SyncSession* s(new SyncSession(session_context_.get(), this, |
| + old->source(), old->routing_info(), old->workers())); |
| + SyncSessionJob new_job = {job.purpose, TimeTicks::Now(), |
| + make_linked_ptr(s), false, job.nudge_location}; |
| + wait_interval_->pending_configure_job.reset(new SyncSessionJob(new_job)); |
| } |
| } |
| @@ -240,8 +268,9 @@ void SyncerThread::ScheduleNudge(const TimeDelta& delay, |
| ModelTypePayloadMap types_with_payloads = |
| syncable::ModelTypePayloadMapFromBitSet(types, std::string()); |
| thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| - this, &SyncerThread::ScheduleNudgeImpl, delay, source, |
| - types_with_payloads, nudge_location)); |
| + this, &SyncerThread::ScheduleNudgeImpl, delay, |
| + GetUpdatesFromNudgeSource(source), types_with_payloads, false, |
| + nudge_location)); |
| } |
| void SyncerThread::ScheduleNudgeWithPayloads(const TimeDelta& delay, |
| @@ -253,8 +282,9 @@ void SyncerThread::ScheduleNudgeWithPayloads(const TimeDelta& delay, |
| } |
| thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| - this, &SyncerThread::ScheduleNudgeImpl, delay, source, |
| - types_with_payloads, nudge_location)); |
| + this, &SyncerThread::ScheduleNudgeImpl, delay, |
| + GetUpdatesFromNudgeSource(source), types_with_payloads, false, |
| + nudge_location)); |
| } |
| void SyncerThread::ScheduleClearUserDataImpl() { |
| @@ -267,15 +297,10 @@ void SyncerThread::ScheduleClearUserDataImpl() { |
| } |
| void SyncerThread::ScheduleNudgeImpl(const TimeDelta& delay, |
| - NudgeSource source, const ModelTypePayloadMap& types_with_payloads, |
| - const tracked_objects::Location& nudge_location) { |
| + GetUpdatesCallerInfo::GetUpdatesSource source, |
| + const ModelTypePayloadMap& types_with_payloads, |
| + bool is_canary_job, const tracked_objects::Location& nudge_location) { |
| DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); |
| - TimeTicks rough_start = TimeTicks::Now() + delay; |
| - if (!ShouldRunJob(NUDGE, rough_start)) { |
| - LOG(WARNING) << "Dropping nudge at scheduling time, source = " |
| - << source; |
| - return; |
| - } |
| // Note we currently nudge for all types regardless of the ones incurring |
| // the nudge. Doing different would throw off some syncer commands like |
| @@ -284,29 +309,38 @@ void SyncerThread::ScheduleNudgeImpl(const TimeDelta& delay, |
| std::vector<ModelSafeWorker*> workers; |
| session_context_->registrar()->GetModelSafeRoutingInfo(&routes); |
| session_context_->registrar()->GetWorkers(&workers); |
| - SyncSourceInfo info(GetUpdatesFromNudgeSource(source), |
| - types_with_payloads); |
| + SyncSourceInfo info(source, types_with_payloads); |
| - scoped_ptr<SyncSession> session(new SyncSession( |
| + SyncSession* session(new SyncSession( |
| session_context_.get(), this, info, routes, workers)); |
| + SyncSessionJob job = {NUDGE, TimeTicks::Now() + delay, |
| + make_linked_ptr(session), is_canary_job, |
| + nudge_location}; |
| + |
| + session = NULL; |
| + if (!ShouldRunJob(job)) |
| + return; |
| + |
| if (pending_nudge_.get()) { |
| if (IsBackingOff() && delay > TimeDelta::FromSeconds(1)) |
| return; |
| - pending_nudge_->session->Coalesce(*session.get()); |
| + UpdatePendingJob(job); |
|
tim (not reviewing)
2011/04/09 23:52:58
I think this was more clear when we just did the c
lipalani1
2011/04/12 02:33:00
Done.
|
| if (!IsBackingOff()) { |
| return; |
| } else { |
| // Re-schedule the current pending nudge. |
| SyncSession* s = pending_nudge_->session.get(); |
| - session.reset(new SyncSession(s->context(), s->delegate(), s->source(), |
| - s->routing_info(), s->workers())); |
| + job.session.reset(new SyncSession(s->context(), s->delegate(), |
| + s->source(), s->routing_info(), s->workers())); |
| pending_nudge_.reset(); |
| } |
| } |
| - ScheduleSyncSessionJob(delay, NUDGE, session.release(), nudge_location); |
| + |
| + // TODO(lipalani) - pass the job itself to ScheduleSyncSessionJob. |
| + ScheduleSyncSessionJob(delay, NUDGE, job.session.release(), nudge_location); |
| } |
| // Helper to extract the routing info and workers corresponding to types in |
| @@ -354,21 +388,23 @@ void SyncerThread::ScheduleConfig(const ModelTypeBitSet& types) { |
| &routes, &workers); |
| thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| - this, &SyncerThread::ScheduleConfigImpl, routes, workers)); |
| + this, &SyncerThread::ScheduleConfigImpl, routes, workers, |
| + GetUpdatesCallerInfo::FIRST_UPDATE)); |
| } |
| void SyncerThread::ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, |
| - const std::vector<ModelSafeWorker*>& workers) { |
| + const std::vector<ModelSafeWorker*>& workers, |
| + const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
| DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); |
| // TODO(tim): config-specific GetUpdatesCallerInfo value? |
| SyncSession* session = new SyncSession(session_context_.get(), this, |
| - SyncSourceInfo(GetUpdatesCallerInfo::FIRST_UPDATE, |
| + SyncSourceInfo(source, |
| syncable::ModelTypePayloadMapFromRoutingInfo( |
| routing_info, std::string())), |
| routing_info, workers); |
| ScheduleSyncSessionJob(TimeDelta::FromSeconds(0), CONFIGURATION, session, |
| - FROM_HERE); |
| + FROM_HERE); |
| } |
| void SyncerThread::ScheduleSyncSessionJob(const base::TimeDelta& delay, |
| @@ -377,7 +413,7 @@ void SyncerThread::ScheduleSyncSessionJob(const base::TimeDelta& delay, |
| DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); |
| SyncSessionJob job = {purpose, TimeTicks::Now() + delay, |
| - make_linked_ptr(session), nudge_location}; |
| + make_linked_ptr(session), false, nudge_location}; |
| if (purpose == NUDGE) { |
| DCHECK(!pending_nudge_.get() || pending_nudge_->session.get() == session); |
| pending_nudge_.reset(new SyncSessionJob(job)); |
| @@ -409,11 +445,8 @@ void SyncerThread::SetSyncerStepsForPurpose(SyncSessionJobPurpose purpose, |
| void SyncerThread::DoSyncSessionJob(const SyncSessionJob& job) { |
| DCHECK_EQ(MessageLoop::current(), thread_.message_loop()); |
| - if (!ShouldRunJob(job.purpose, job.scheduled_start)) { |
| - LOG(WARNING) << "Dropping nudge at DoSyncSessionJob, source = " |
| - << job.session->source().updates_source; |
| + if (!ShouldRunJob(job)) |
| return; |
| - } |
| if (job.purpose == NUDGE) { |
| DCHECK(pending_nudge_.get()); |
| @@ -427,13 +460,17 @@ void SyncerThread::DoSyncSessionJob(const SyncSessionJob& job) { |
| SetSyncerStepsForPurpose(job.purpose, &begin, &end); |
| bool has_more_to_sync = true; |
| - while (ShouldRunJob(job.purpose, job.scheduled_start) && has_more_to_sync) { |
| + while (ShouldRunJob(job) && has_more_to_sync) { |
| VLOG(1) << "SyncerThread: Calling SyncShare."; |
| // Synchronously perform the sync session from this thread. |
| syncer_->SyncShare(job.session.get(), begin, end); |
| has_more_to_sync = job.session->HasMoreToSync(); |
| if (has_more_to_sync) |
| job.session->ResetTransientState(); |
| + if (IsSyncingCurrentlySilenced()) { |
| + DCHECK_NE(job.purpose, CLEAR_USER_DATA); |
| + SaveJob(job); |
|
tim (not reviewing)
2011/04/09 23:52:58
This if-block seems out of place...we should be do
lipalani1
2011/04/12 02:33:00
Good point. Done.
On 2011/04/09 23:52:58, timsteel
|
| + } |
| } |
| VLOG(1) << "SyncerThread: Done SyncShare looping."; |
| FinishSyncSessionJob(job); |
| @@ -519,8 +556,16 @@ void SyncerThread::ScheduleNextSync(const SyncSessionJob& old_job) { |
| } else { |
| // We weren't continuing and we aren't in backoff. Schedule a normal |
| // continuation. |
| - ScheduleNudgeImpl(TimeDelta::FromSeconds(0), NUDGE_SOURCE_CONTINUATION, |
| - old_job.session->source().types, FROM_HERE); |
| + if (old_job.purpose == CONFIGURATION) { |
| + ScheduleConfigImpl(old_job.session->routing_info(), |
| + old_job.session->workers(), |
| + GetUpdatesFromNudgeSource(NUDGE_SOURCE_CONTINUATION)); |
| + } else { |
| + // For all other purposes(nudge and poll) we schedule a retry nudge. |
| + ScheduleNudgeImpl(TimeDelta::FromSeconds(0), |
| + GetUpdatesFromNudgeSource(NUDGE_SOURCE_CONTINUATION), |
| + old_job.session->source().types, false, FROM_HERE); |
| + } |
| } |
| } |
| @@ -556,9 +601,21 @@ void SyncerThread::HandleConsecutiveContinuationError( |
| IsBackingOff() ? wait_interval_->length : TimeDelta::FromSeconds(1)); |
| wait_interval_.reset(new WaitInterval(WaitInterval::EXPONENTIAL_BACKOFF, |
| length)); |
| - SyncSessionJob job = {NUDGE, TimeTicks::Now() + length, |
| - make_linked_ptr(s), FROM_HERE}; |
| - pending_nudge_.reset(new SyncSessionJob(job)); |
| + if (old_job.purpose == CONFIGURATION) { |
| + SyncSessionJob job = {old_job.purpose, TimeTicks::Now() + length, |
| + make_linked_ptr(s), false, FROM_HERE}; |
| + wait_interval_->pending_configure_job.reset(new SyncSessionJob(job)); |
| + } else { |
| + // We are not in configuration mode. So wait_interval's pending job |
|
tim (not reviewing)
2011/04/09 23:52:58
I'm rather concerned about the apparent connection
lipalani1
2011/04/12 02:33:00
Hmm.. not sure I follow. let me sync up with you.
|
| + // should be null. |
| + DCHECK(wait_interval_->pending_configure_job.get() == NULL); |
| + |
| + // No matter what type of job it is.(nudge or poll, it cannot be config) |
| + // We are going to treat it as nudge when doing exponential back off |
| + // retries. |
| + // TODO(lipalani) - handle clear user data. |
| + UpdatePendingJob(old_job); |
| + } |
| wait_interval_->timer.Start(length, this, &SyncerThread::DoCanaryJob); |
| } |
| @@ -593,9 +650,38 @@ void SyncerThread::Stop() { |
| } |
| void SyncerThread::DoCanaryJob() { |
| - DCHECK(pending_nudge_.get()); |
| + // We should not be here unless wait interval was initialized due to |
| + // throttling or backing off. |
| + DCHECK(wait_interval_.get()); |
| + |
| wait_interval_->had_nudge = false; |
| - SyncSessionJob copy = *pending_nudge_; |
| + |
| + // We should have one of 2 things. Otherwise we shouldnt be running the timer. |
| + DCHECK(wait_interval_->pending_configure_job.get() || pending_nudge_.get()); |
| + ExecutePendingJob(); |
| +} |
| + |
| +void SyncerThread::ExecutePendingJob() { |
| + if (mode_ == CONFIGURATION_MODE) { |
| + if (wait_interval_.get() && wait_interval_->pending_configure_job.get()) { |
| + ExecuteJobByMakingACopy(wait_interval_->pending_configure_job.get()); |
| + } |
| + } else { |
| + if (pending_nudge_.get()) { |
| + // Pending jobs mostly have time from the past. Reset it so this job |
| + // will get executed. |
| + if (pending_nudge_->scheduled_start < TimeTicks::Now()) |
| + pending_nudge_->scheduled_start = TimeTicks::Now(); |
| + // The pending nudge would be cleared in the DoSyncSessionJob function. |
| + ExecuteJobByMakingACopy(pending_nudge_.get()); |
| + } |
| + } |
| +} |
| + |
| +void SyncerThread::ExecuteJobByMakingACopy(SyncSessionJob* job) { |
| + DCHECK(job); |
| + SyncSessionJob copy = *job; |
| + copy.is_canary_job = true; |
| DoSyncSessionJob(copy); |
| } |
| @@ -614,6 +700,7 @@ void SyncerThread::PollTimerCallback() { |
| void SyncerThread::Unthrottle() { |
| DCHECK_EQ(WaitInterval::THROTTLED, wait_interval_->mode); |
| + DoCanaryJob(); |
| wait_interval_.reset(); |
| } |