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

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: 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/internal_api/sync_manager.cc ('k') | sync/sessions/sync_session_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session_context.h
diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h
index b1fc2971bc1657a65a07c52cb2ad9317764f933d..ebde3f3c9a6f062843c1cf7b8669fddba2a72f03 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/sync_engine_event.h"
#include "sync/engine/syncer_types.h"
@@ -40,6 +39,7 @@ namespace browser_sync {
class ConflictResolver;
class ExtensionsActivityMonitor;
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 {
const ModelSafeRoutingInfo& model_safe_routing_info,
const std::vector<ModelSafeWorker*>& workers,
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();
+ ~SyncSessionContext();
ConflictResolver* resolver() { return resolver_; }
ServerConnectionManager* connection_manager() {
@@ -87,6 +85,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_;
}
@@ -122,29 +124,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.
@@ -184,14 +168,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);
« no previous file with comments | « sync/internal_api/sync_manager.cc ('k') | sync/sessions/sync_session_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698