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

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: Cleaned up and rebased Created 8 years, 7 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 23bdf451db2487a3e970851bfd3742710487a989..98998713a9b76201483a22dbacbd3226bfacd782 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/stringprintf.h"
+#include "sync/engine/throttled_data_type_tracker.h"
tim (not reviewing) 2012/06/11 18:53:46 include order (tools/sort-headers.py is great!)
rlarocque 2012/06/11 23:28:51 Done.
#include "sync/engine/net/server_connection_manager.h"
#include "sync/engine/syncer.h"
#include "sync/engine/syncer_types.h"
@@ -213,14 +214,14 @@ base::TimeDelta SyncerProtoUtil::GetThrottleDelay(
void SyncerProtoUtil::HandleThrottleError(
const SyncProtocolError& error,
const base::TimeTicks& throttled_until,
- sessions::SyncSessionContext* context,
+ ThrottledDataTypeTracker* tdtt,
tim (not reviewing) 2012/06/11 18:53:46 We should try to use as meaningful a name as possi
rlarocque 2012/06/11 23:28:51 Done.
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);
+ tdtt->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:

Powered by Google App Engine
This is Rietveld 408576698