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

Unified Diff: sync/engine/syncer_proto_util.cc

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 6 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/syncer_proto_util.h ('k') | sync/engine/syncer_proto_util_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 bdadda1287bfca1352eef69cc0fa6a6fbbe3c8f6..294f0eff98e7965d842f4bb4d3b277f197d43d7d 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -9,6 +9,7 @@
#include "sync/engine/net/server_connection_manager.h"
#include "sync/engine/syncer.h"
#include "sync/engine/syncer_types.h"
+#include "sync/engine/throttled_data_type_tracker.h"
#include "sync/engine/traffic_logger.h"
#include "sync/internal_api/public/syncable/model_type.h"
#include "sync/protocol/sync.pb.h"
@@ -213,14 +214,14 @@ base::TimeDelta SyncerProtoUtil::GetThrottleDelay(
void SyncerProtoUtil::HandleThrottleError(
const SyncProtocolError& error,
const base::TimeTicks& throttled_until,
- sessions::SyncSessionContext* context,
+ ThrottledDataTypeTracker* tracker,
sessions::SyncSession::Delegate* delegate) {
DCHECK_EQ(error.error_type, browser_sync::THROTTLED);
if (error.error_data_types.Empty()) {
// No datatypes indicates the client should be completely throttled.
delegate->OnSilencedUntil(throttled_until);
} else {
- context->SetUnthrottleTime(error.error_data_types, throttled_until);
+ tracker->SetUnthrottleTime(error.error_data_types, throttled_until);
}
}
@@ -393,7 +394,7 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
LOG(WARNING) << "Client silenced by server.";
HandleThrottleError(sync_protocol_error,
base::TimeTicks::Now() + GetThrottleDelay(*response),
- session->context(),
+ session->context()->throttled_data_type_tracker(),
session->delegate());
return SERVER_RETURN_THROTTLED;
case browser_sync::TRANSIENT_ERROR:
« no previous file with comments | « sync/engine/syncer_proto_util.h ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698