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

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: 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.cc
diff --git a/sync/sessions/sync_session_context.cc b/sync/sessions/sync_session_context.cc
index dbbaaf91109cbe19811f1dc07f209f75cf28b76d..638865fc8b77ff07053e572e48a8d3f2043620eb 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"
@@ -18,6 +19,7 @@ SyncSessionContext::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)
@@ -28,6 +30,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;
@@ -35,52 +38,8 @@ SyncSessionContext::SyncSessionContext(
listeners_.AddObserver(*it);
}
-SyncSessionContext::SyncSessionContext()
- : connection_manager_(NULL),
- directory_(NULL),
- registrar_(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

Powered by Google App Engine
This is Rietveld 408576698