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

Unified Diff: chrome/browser/sync/engine/syncer_proto_util.cc

Issue 7605021: Make the throttle delay configurable by the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments. Created 9 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 | « chrome/browser/sync/engine/syncer_proto_util.h ('k') | chrome/browser/sync/protocol/sync.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncer_proto_util.cc
diff --git a/chrome/browser/sync/engine/syncer_proto_util.cc b/chrome/browser/sync/engine/syncer_proto_util.cc
index 6dae7689f12e54886bdb2e3844ff305f598fc48b..61f64fad5a9f6272793c20f521563d604aee6d78 100644
--- a/chrome/browser/sync/engine/syncer_proto_util.cc
+++ b/chrome/browser/sync/engine/syncer_proto_util.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/sync/engine/syncer_types.h"
#include "chrome/browser/sync/engine/syncer_util.h"
#include "chrome/browser/sync/protocol/service_constants.h"
+#include "chrome/browser/sync/protocol/sync.pb.h"
#include "chrome/browser/sync/sessions/sync_session.h"
#include "chrome/browser/sync/syncable/directory_manager.h"
#include "chrome/browser/sync/syncable/model_type.h"
@@ -182,6 +183,20 @@ bool SyncerProtoUtil::PostAndProcessHeaders(ServerConnectionManager* scm,
return false;
}
+base::TimeDelta SyncerProtoUtil::GetThrottleDelay(
+ const sync_pb::ClientToServerResponse& response) {
+ base::TimeDelta throttle_delay =
+ base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled);
+ if (response.has_client_command()) {
+ const sync_pb::ClientCommand& command = response.client_command();
+ if (command.has_throttle_delay_seconds()) {
+ throttle_delay =
+ base::TimeDelta::FromSeconds(command.throttle_delay_seconds());
+ }
+ }
+ return throttle_delay;
+}
+
namespace {
// Helper function for an assertion in PostClientToServerMessage.
@@ -236,7 +251,7 @@ bool SyncerProtoUtil::PostClientToServerMessage(
case ClientToServerResponse::THROTTLED:
LOG(WARNING) << "Client silenced by server.";
session->delegate()->OnSilencedUntil(base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled));
+ GetThrottleDelay(*response));
return false;
case ClientToServerResponse::TRANSIENT_ERROR:
return false;
« no previous file with comments | « chrome/browser/sync/engine/syncer_proto_util.h ('k') | chrome/browser/sync/protocol/sync.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698