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

Unified Diff: sync/engine/sync_scheduler_impl.h

Issue 488843002: [Sync] Add support for server controlled nudge delays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 6 years, 4 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: sync/engine/sync_scheduler_impl.h
diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h
index 7cb295b37c8f578851edd83e8c95c5fdf66a49c2..756690b35aae0bcb3ca45238bf9cd809490a8a0c 100644
--- a/sync/engine/sync_scheduler_impl.h
+++ b/sync/engine/sync_scheduler_impl.h
@@ -56,23 +56,18 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
const ConfigurationParams& params) OVERRIDE;
virtual void Stop() OVERRIDE;
virtual void ScheduleLocalNudge(
- const base::TimeDelta& desired_delay,
ModelTypeSet types,
const tracked_objects::Location& nudge_location) OVERRIDE;
virtual void ScheduleLocalRefreshRequest(
- const base::TimeDelta& desired_delay,
ModelTypeSet types,
const tracked_objects::Location& nudge_location) OVERRIDE;
virtual void ScheduleInvalidationNudge(
- const base::TimeDelta& desired_delay,
syncer::ModelType type,
scoped_ptr<InvalidationInterface> invalidation,
const tracked_objects::Location& nudge_location) OVERRIDE;
virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) OVERRIDE;
virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE;
- virtual base::TimeDelta GetSessionsCommitDelay() const OVERRIDE;
-
virtual void OnCredentialsUpdated() OVERRIDE;
virtual void OnConnectionStatusChange() OVERRIDE;
@@ -86,8 +81,8 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
const base::TimeDelta& new_interval) OVERRIDE;
virtual void OnReceivedLongPollIntervalUpdate(
const base::TimeDelta& new_interval) OVERRIDE;
- virtual void OnReceivedSessionsCommitDelay(
- const base::TimeDelta& new_delay) OVERRIDE;
+ virtual void OnReceivedCustomNudgeDelays(
+ const std::map<ModelType, int>& nudge_delays) OVERRIDE;
virtual void OnReceivedClientInvalidationHintBufferSize(int size) OVERRIDE;
virtual void OnSyncProtocolError(
const SyncProtocolError& sync_protocol_error) OVERRIDE;
@@ -97,6 +92,9 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
// Returns true if the client is currently in exponential backoff.
bool IsBackingOff() const;
+ // Returns the nudge delay to be used based on |types|.
+ base::TimeDelta GetNudgeDelayForTypes(ModelTypeSet types) const;
+
private:
enum JobPriority {
// Non-canary jobs respect exponential backoff.
@@ -150,6 +148,8 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
static const char* GetModeString(Mode mode);
+ void SetDefaultNudgeDelay(int delay_ms);
+
// Invoke the syncer to perform a nudge job.
void DoNudgeSyncSessionJob(JobPriority priority);
@@ -251,8 +251,9 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
base::TimeDelta syncer_short_poll_interval_seconds_;
base::TimeDelta syncer_long_poll_interval_seconds_;
- // Server-tweakable sessions commit delay.
- base::TimeDelta sessions_commit_delay_;
+ // Server-tweakable custom nudge delays.
rlarocque 2014/08/20 00:13:31 The nudge delay tracking code is somewhat complica
Nicolas Zea 2014/08/20 22:49:43 Discussed offline, moved this state into NudgeTrac
+ int minimum_nudge_delay_ms_;
+ std::map<ModelType, base::TimeDelta> nudge_delays_;
// Periodic timer for polling. See AdjustPolling.
base::RepeatingTimer<SyncSchedulerImpl> poll_timer_;

Powered by Google App Engine
This is Rietveld 408576698