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

Unified Diff: chrome/browser/sync/sessions/sync_session_context.cc

Issue 8631021: [Sync] Prevent uploading throttled datatypes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 years, 1 month 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: chrome/browser/sync/sessions/sync_session_context.cc
diff --git a/chrome/browser/sync/sessions/sync_session_context.cc b/chrome/browser/sync/sessions/sync_session_context.cc
index c0aeb3445e8cef70bdf4716d6ad00f44814b661f..170baa3ec85bcfa01f889b711472e02771dd3a3b 100644
--- a/chrome/browser/sync/sessions/sync_session_context.cc
+++ b/chrome/browser/sync/sessions/sync_session_context.cc
@@ -58,5 +58,39 @@ void SyncSessionContext::SetUnthrottleTime(const syncable::ModelTypeSet& types,
}
}
+syncable::ModelTypeSet SyncSessionContext::
+ UpdateAndGetCurrentlyThrottledTypes() {
+ UpdateThrottledTypes(base::TimeTicks::Now());
+ return GetThrottledTypes();
+}
+
+void SyncSessionContext::UpdateThrottledTypes(const base::TimeTicks& time) {
+ UnthrottleTimes::const_iterator it = unthrottle_times_.begin();
+ while (it != unthrottle_times_.end()) {
+ if (it->second <= time) {
+ // Delete and increment the iterator.
+ UnthrottleTimes::const_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.insert(it->first);
+ }
+ return types;
+}
+
+
} // namespace sessions
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698