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

Unified Diff: sync/sessions/sync_session_context.h

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/sessions/sync_session_context.h
diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h
index 12a9a444bebb5112886e4ff1d9f3f20cf23c873f..aeea22915381333c95807e81845ee4a371887186 100644
--- a/sync/sessions/sync_session_context.h
+++ b/sync/sessions/sync_session_context.h
@@ -23,7 +23,6 @@
#include <string>
#include <vector>
-#include "base/gtest_prod_util.h"
#include "base/time.h"
#include "sync/engine/model_safe_worker.h"
#include "sync/engine/syncer_types.h"
@@ -41,6 +40,7 @@ class ConflictResolver;
class ExtensionsActivityMonitor;
class ModelSafeWorkerRegistrar;
class ServerConnectionManager;
+class ThrottledDataTypeTracker;
// Default number of items a client can commit in a single message.
static const int kDefaultMaxCommitBatchSize = 25;
@@ -55,13 +55,11 @@ class SyncSessionContext {
syncable::Directory* directory,
ModelSafeWorkerRegistrar* model_safe_worker_registrar,
ExtensionsActivityMonitor* extensions_activity_monitor,
+ ThrottledDataTypeTracker* throttled_data_type_tracker,
const std::vector<SyncEngineEventListener*>& listeners,
DebugInfoGetter* debug_info_getter,
browser_sync::TrafficRecorder* traffic_recorder);
-
- // Empty constructor for unit tests.
- SyncSessionContext();
- virtual ~SyncSessionContext();
tim (not reviewing) 2012/06/11 18:53:46 Was MockSyncSessionContext in syncer_proto_util_un
rlarocque 2012/06/11 23:28:51 I assumed so, since a grep for 'public' and 'SyncS
+ ~SyncSessionContext();
ConflictResolver* resolver() { return resolver_; }
ServerConnectionManager* connection_manager() {
@@ -78,6 +76,10 @@ class SyncSessionContext {
return extensions_activity_monitor_;
}
+ ThrottledDataTypeTracker* throttled_data_type_tracker() {
+ return throttled_data_type_tracker_;
+ }
+
DebugInfoGetter* debug_info_getter() {
return debug_info_getter_;
}
@@ -113,29 +115,11 @@ class SyncSessionContext {
OnSyncEngineEvent(event));
}
- // This is virtual for unit tests.
- virtual void SetUnthrottleTime(syncable::ModelTypeSet types,
- const base::TimeTicks& time);
-
- // This prunes the |unthrottle_time_| map based on the |time| passed in. This
- // is called by syncer at the SYNCER_BEGIN stage.
- void PruneUnthrottledTypes(const base::TimeTicks& time);
-
- // This returns the list of currently throttled types. Unless server returns
- // new throttled types this will remain constant through out the sync cycle.
- syncable::ModelTypeSet GetThrottledTypes() const;
-
browser_sync::TrafficRecorder* traffic_recorder() {
return traffic_recorder_;
}
private:
- typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes;
-
- FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, AddUnthrottleTimeTest);
- FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest,
- GetCurrentlyThrottledTypesTest);
-
// Rather than force clients to set and null-out various context members, we
// extend our encapsulation boundary to scoped helpers that take care of this
// once they are allocated. See definitions of these below.
@@ -172,14 +156,12 @@ class SyncSessionContext {
// by the user.
ModelSafeRoutingInfo previous_session_routing_info_;
+ ThrottledDataTypeTracker* throttled_data_type_tracker_;
+
// We use this to get debug info to send to the server for debugging
// client behavior on server side.
DebugInfoGetter* const debug_info_getter_;
- // This is a map from throttled data types to the time at which they can be
- // unthrottled.
- UnthrottleTimes unthrottle_times_;
-
browser_sync::TrafficRecorder* traffic_recorder_;
DISALLOW_COPY_AND_ASSIGN(SyncSessionContext);

Powered by Google App Engine
This is Rietveld 408576698