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

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: 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/syncer_proto_util.cc
diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc
index fe2a875bccc799ccfdf682b30014df1c3b9dcba6..b03aa90c0210f479602aab9e90b321337b50fa42 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -420,9 +420,9 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
}
if (command.has_sessions_commit_delay_seconds()) {
- session->delegate()->OnReceivedSessionsCommitDelay(
- base::TimeDelta::FromSeconds(
- command.sessions_commit_delay_seconds()));
+ std::map<ModelType, int> delay_map;
+ delay_map[SESSIONS] = command.sessions_commit_delay_seconds() * 1000;
+ session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
}
if (command.has_client_invalidation_hint_buffer_size()) {
@@ -434,6 +434,19 @@ 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, int> delay_map;
+ for (int i = 0; i < command.custom_nudge_delays_size(); ++i) {
+ delay_map[GetModelTypeFromSpecificsFieldNumber(
rlarocque 2014/08/20 00:13:31 Should we be more defensive against unknown model
Nicolas Zea 2014/08/20 22:49:43 Good call, this has bitten us before.
+ command.custom_nudge_delays(i).datatype_id())] =
+ 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

Powered by Google App Engine
This is Rietveld 408576698