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

Unified Diff: sync/engine/syncer_proto_util.cc

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/engine/sync_scheduler_unittest.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/syncer_proto_util.cc
diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc
index fe2a875bccc799ccfdf682b30014df1c3b9dcba6..44ac321a16b5706695a5329222633b4e6dcb72fb 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -420,9 +420,10 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
}
if (command.has_sessions_commit_delay_seconds()) {
- session->delegate()->OnReceivedSessionsCommitDelay(
- base::TimeDelta::FromSeconds(
- command.sessions_commit_delay_seconds()));
+ std::map<ModelType, base::TimeDelta> delay_map;
+ delay_map[SESSIONS] =
+ base::TimeDelta::FromSeconds(command.sessions_commit_delay_seconds());
+ session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
}
if (command.has_client_invalidation_hint_buffer_size()) {
@@ -434,6 +435,22 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
session->delegate()->OnReceivedGuRetryDelay(
base::TimeDelta::FromSeconds(command.gu_retry_delay_seconds()));
}
+
+ if (command.custom_nudge_delays_size() > 0) {
+ // Note that because this happens after the sessions_commit_delay_seconds
+ // handling, any SESSIONS value in this map will override the one in
+ // sessions_commit_delay_seconds.
+ std::map<ModelType, base::TimeDelta> delay_map;
+ for (int i = 0; i < command.custom_nudge_delays_size(); ++i) {
+ ModelType type = GetModelTypeFromSpecificsFieldNumber(
+ command.custom_nudge_delays(i).datatype_id());
+ if (ProtocolTypes().Has(type)) {
+ delay_map[type] = base::TimeDelta::FromMilliseconds(
+ command.custom_nudge_delays(i).delay_ms());
+ }
+ }
+ session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
+ }
}
// Now do any special handling for the error type and decide on the return
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698