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

Unified Diff: sync/sessions/sync_session_context.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/sessions/sync_session_context.h ('k') | sync/sessions/sync_session_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session_context.cc
diff --git a/sync/sessions/sync_session_context.cc b/sync/sessions/sync_session_context.cc
index 8af195522cedb5d6cdd8893ec000876fb234438c..ce9d938a637131942777ea5650f598a472d843e5 100644
--- a/sync/sessions/sync_session_context.cc
+++ b/sync/sessions/sync_session_context.cc
@@ -4,6 +4,7 @@
#include "sync/sessions/sync_session_context.h"
+#include "sync/engine/throttled_data_type_tracker.h"
#include "sync/sessions/debug_info_getter.h"
#include "sync/util/extensions_activity_monitor.h"
@@ -19,6 +20,7 @@ SyncSessionContext::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)
@@ -30,6 +32,7 @@ SyncSessionContext::SyncSessionContext(
extensions_activity_monitor_(extensions_activity_monitor),
notifications_enabled_(false),
max_commit_batch_size_(kDefaultMaxCommitBatchSize),
+ throttled_data_type_tracker_(throttled_data_type_tracker),
debug_info_getter_(debug_info_getter),
traffic_recorder_(traffic_recorder) {
std::vector<SyncEngineEventListener*>::const_iterator it;
@@ -37,51 +40,8 @@ SyncSessionContext::SyncSessionContext(
listeners_.AddObserver(*it);
}
-SyncSessionContext::SyncSessionContext()
- : connection_manager_(NULL),
- directory_(NULL),
- extensions_activity_monitor_(NULL),
- debug_info_getter_(NULL),
- traffic_recorder_(NULL) {
-}
-
SyncSessionContext::~SyncSessionContext() {
}
-void SyncSessionContext::SetUnthrottleTime(syncable::ModelTypeSet types,
- const base::TimeTicks& time) {
- for (syncable::ModelTypeSet::Iterator it = types.First();
- it.Good(); it.Inc()) {
- unthrottle_times_[it.Get()] = time;
- }
-}
-
-void SyncSessionContext::PruneUnthrottledTypes(const base::TimeTicks& time) {
- UnthrottleTimes::iterator it = unthrottle_times_.begin();
- while (it != unthrottle_times_.end()) {
- if (it->second <= time) {
- // Delete and increment the iterator.
- UnthrottleTimes::iterator iterator_to_delete = it;
- ++it;
- unthrottle_times_.erase(iterator_to_delete);
- } else {
- // Just increment the iterator.
- ++it;
- }
- }
-}
-
-// TODO(lipalani): Call this function and fill the return values in snapshot
-// so it could be shown in the about:sync page.
-syncable::ModelTypeSet SyncSessionContext::GetThrottledTypes() const {
- syncable::ModelTypeSet types;
- for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin();
- it != unthrottle_times_.end();
- ++it) {
- types.Put(it->first);
- }
- return types;
-}
-
} // namespace sessions
} // namespace browser_sync
« no previous file with comments | « sync/sessions/sync_session_context.h ('k') | sync/sessions/sync_session_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698