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

Unified Diff: sync/sessions/nudge_tracker.h

Issue 488843002: [Sync] Add support for server controlled nudge delays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « sync/sessions/data_type_tracker.cc ('k') | sync/sessions/nudge_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/nudge_tracker.h
diff --git a/sync/sessions/nudge_tracker.h b/sync/sessions/nudge_tracker.h
index 0397c5dc3dba42e49f442fd33d766f8d13b75a9b..7d6cf0f832c45089384d4aa42db955500415320c 100644
--- a/sync/sessions/nudge_tracker.h
+++ b/sync/sessions/nudge_tracker.h
@@ -12,6 +12,7 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/invalidation_interface.h"
#include "sync/internal_api/public/base/model_type.h"
@@ -53,14 +54,18 @@ class SYNC_EXPORT_PRIVATE NudgeTracker {
void RecordSuccessfulSyncCycle();
// Takes note of a local change.
- void RecordLocalChange(ModelTypeSet types);
+ // Returns the shortest nudge delay from the tracker of each type in |types|.
+ base::TimeDelta RecordLocalChange(ModelTypeSet types);
// Takes note of a locally issued request to refresh a data type.
- void RecordLocalRefreshRequest(ModelTypeSet types);
+ // Returns the current nudge delay for a local refresh.
+ base::TimeDelta RecordLocalRefreshRequest(ModelTypeSet types);
// Takes note of the receipt of an invalidation notice from the server.
- void RecordRemoteInvalidation(syncer::ModelType type,
- scoped_ptr<InvalidationInterface> invalidation);
+ // Returns the current nudge delay for a remote invalidation.
+ base::TimeDelta RecordRemoteInvalidation(
+ syncer::ModelType type,
+ scoped_ptr<InvalidationInterface> invalidation);
// Take note that an initial sync is pending for this type.
void RecordInitialSyncRequired(syncer::ModelType type);
@@ -141,6 +146,13 @@ class SYNC_EXPORT_PRIVATE NudgeTracker {
// SetSyncCycleStartTime() is called at the start of the *next* sync cycle.
void SetNextRetryTime(base::TimeTicks next_retry_time);
+ // Update the per-datatype local change nudge delays.
+ void OnReceivedCustomNudgeDelays(
+ const std::map<ModelType, base::TimeDelta>& delay_map);
+
+ // Update the default nudge delay.
+ void SetDefaultNudgeDelay(base::TimeDelta nudge_delay);
+
private:
typedef std::map<ModelType, DataTypeTracker*> TypeTrackerMap;
@@ -186,6 +198,11 @@ class SYNC_EXPORT_PRIVATE NudgeTracker {
// currently in a sync cycle.
base::TimeTicks sync_cycle_start_time_;
+ // Nudge delays for various events.
+ base::TimeDelta minimum_local_nudge_delay_;
+ base::TimeDelta local_refresh_nudge_delay_;
+ base::TimeDelta remote_invalidation_nudge_delay_;
+
DISALLOW_COPY_AND_ASSIGN(NudgeTracker);
};
« no previous file with comments | « sync/sessions/data_type_tracker.cc ('k') | sync/sessions/nudge_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698