| 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 84abca64ffba9062664e5ee4d9e1e17648c3ac8d..a1caafa15c706e872f4639ed493859af04de2d38 100644
|
| --- a/chrome/browser/sync/engine/syncer_proto_util.cc
|
| +++ b/chrome/browser/sync/engine/syncer_proto_util.cc
|
| @@ -187,6 +187,20 @@ base::TimeDelta SyncerProtoUtil::GetThrottleDelay(
|
| return throttle_delay;
|
| }
|
|
|
| +void SyncerProtoUtil::HandleThrottleError(
|
| + const SyncProtocolError& error,
|
| + const base::TimeTicks& throttled_until,
|
| + sessions::SyncSessionContext* context,
|
| + sessions::SyncSession::Delegate* delegate) {
|
| + DCHECK_EQ(error.error_type, browser_sync::THROTTLED);
|
| + if (error.error_data_types.size() > 0) {
|
| + context->SetUnthrottleTime(error.error_data_types, throttled_until);
|
| + } else {
|
| + // No datatypes indicates the client should be completely throttled.
|
| + delegate->OnSilencedUntil(throttled_until);
|
| + }
|
| +}
|
| +
|
| namespace {
|
|
|
| // Helper function for an assertion in PostClientToServerMessage.
|
| @@ -258,6 +272,17 @@ browser_sync::SyncProtocolError ConvertErrorPBToLocalType(
|
| sync_protocol_error.url = error.url();
|
| sync_protocol_error.action = ConvertClientActionPBToLocalClientAction(
|
| error.action());
|
| +
|
| + if (error.error_data_type_ids_size() > 0) {
|
| + // THROTTLED is currently the only error code that uses |error_data_types|.
|
| + DCHECK_EQ(error.error_type(), ClientToServerResponse::THROTTLED);
|
| + for (int i = 0; i < error.error_data_type_ids_size(); ++i) {
|
| + sync_protocol_error.error_data_types.insert(
|
| + syncable::GetModelTypeFromExtensionFieldNumber(
|
| + error.error_data_type_ids(i)));
|
| + }
|
| + }
|
| +
|
| return sync_protocol_error;
|
| }
|
|
|
| @@ -331,8 +356,10 @@ bool SyncerProtoUtil::PostClientToServerMessage(
|
| return true;
|
| case browser_sync::THROTTLED:
|
| LOG(WARNING) << "Client silenced by server.";
|
| - session->delegate()->OnSilencedUntil(base::TimeTicks::Now() +
|
| - GetThrottleDelay(*response));
|
| + HandleThrottleError(sync_protocol_error,
|
| + base::TimeTicks::Now() + GetThrottleDelay(*response),
|
| + session->context(),
|
| + session->delegate());
|
| return false;
|
| case browser_sync::TRANSIENT_ERROR:
|
| return false;
|
|
|