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

Unified Diff: chrome/browser/sync/engine/syncer_thread2.h

Issue 6812004: sync: Make nudge + config jobs reliable in SyncerThread2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing a typo. Created 9 years, 8 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: chrome/browser/sync/engine/syncer_thread2.h
diff --git a/chrome/browser/sync/engine/syncer_thread2.h b/chrome/browser/sync/engine/syncer_thread2.h
index 3fbdd7f26d437f92a98009ef33933bf9ef1050a4..4f86dc5aa4a90eac0b6c372ab6ca9c03eedd314b 100644
--- a/chrome/browser/sync/engine/syncer_thread2.h
+++ b/chrome/browser/sync/engine/syncer_thread2.h
@@ -43,6 +43,15 @@ class SyncerThread : public sessions::SyncSession::Delegate,
NORMAL_MODE,
};
+ enum JobProcessDecision {
+ // Indicates we should continue with the current job.
+ CONTINUE,
+ // Indicates that we should save it to be processed later.
+ SAVE,
+ // Indicates we should drop this job.
+ DROP,
+ };
+
// Takes ownership of both |context| and |syncer|.
SyncerThread(sessions::SyncSessionContext* context, Syncer* syncer);
virtual ~SyncerThread();
@@ -161,22 +170,29 @@ class SyncerThread : public sessions::SyncSession::Delegate,
// Helper to ScheduleNextSync in case of consecutive sync errors.
void HandleConsecutiveContinuationError(const SyncSessionJob& old_job);
- // Determines if it is legal to run a sync job for |purpose| at
- // |scheduled_start|. This checks current operational mode, backoff or
+ // Determines if it is legal to run a sync |job|.
+ // This checks current operational mode, backoff or
// throttling, freshness (so we don't make redundant syncs), and connection.
- bool ShouldRunJob(SyncSessionJobPurpose purpose,
- const base::TimeTicks& scheduled_start);
+ bool ShouldRunJob(const SyncSessionJob& job);
+
+ // Decide on whether to run, save or discard the job when we are in
+ // back off mode.
+ JobProcessDecision DecideOnJobWhileBackingOff(const SyncSessionJob& job);
+
+ // Decide whether we should run, save or discard the job.
+ JobProcessDecision ProcessJob(const SyncSessionJob& job);
// 'Impl' here refers to real implementation of public functions, running on
// |thread_|.
void StartImpl(Mode mode, linked_ptr<ModeChangeCallback> callback);
void ScheduleNudgeImpl(
const base::TimeDelta& delay,
- NudgeSource source,
+ sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
const syncable::ModelTypePayloadMap& types_with_payloads,
- const tracked_objects::Location& nudge_location);
+ bool is_canary_job, const tracked_objects::Location& nudge_location);
void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info,
- const std::vector<ModelSafeWorker*>& workers);
+ const std::vector<ModelSafeWorker*>& workers,
+ const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
void ScheduleClearUserDataImpl();
// Returns true if the client is currently in exponential backoff.
@@ -243,6 +259,9 @@ class SyncerThread : public sessions::SyncSession::Delegate,
scoped_ptr<sessions::SyncSessionContext> session_context_;
+ bool saved_nudge_;
+ sync_pb::GetUpdatesCallerInfo::GetUpdatesSource saved_source_;
+
DISALLOW_COPY_AND_ASSIGN(SyncerThread);
};
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncer_thread2.cc » ('j') | chrome/browser/sync/engine/syncer_thread2.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698