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

Unified Diff: sync/sessions/nudge_tracker.cc

Issue 13743003: sync: Finish the SyncScheduler refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix AuthErrorTest Created 7 years, 8 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/nudge_tracker.h ('k') | sync/sessions/nudge_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/nudge_tracker.cc
diff --git a/sync/sessions/nudge_tracker.cc b/sync/sessions/nudge_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..714b67d13f14582e427fdf544c40bc44a067dab8
--- /dev/null
+++ b/sync/sessions/nudge_tracker.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/sessions/nudge_tracker.h"
+#include "sync/protocol/sync.pb.h"
+
+namespace syncer {
+namespace sessions {
+
+NudgeTracker::NudgeTracker() { }
+
+NudgeTracker::~NudgeTracker() { }
+
+void NudgeTracker::CoalesceSources(const SyncSourceInfo& source) {
+ CoalesceStates(source.types, &source_info_.types);
+ source_info_.updates_source = source.updates_source;
+}
+
+bool NudgeTracker::IsEmpty() {
+ return source_info_.types.empty();
+}
+
+void NudgeTracker::Reset() {
+ source_info_ = SyncSourceInfo();
+}
+
+// TODO(rlarocque): This function often reports incorrect results. However, it
+// is compatible with the "classic" behaviour. We would need to make the nudge
+// tracker stop overwriting its own information (ie. fix crbug.com/231693)
+// before we could even try to report correct results. The main issue is that
+// an notifications and local modifications nudges may overlap with each other
+// in sych a way that we lose track of which types were or were not locally
+// modified.
+ModelTypeSet NudgeTracker::GetLocallyModifiedTypes() const {
+ ModelTypeSet locally_modified;
+
+ if (source_info_.updates_source != sync_pb::GetUpdatesCallerInfo::LOCAL) {
+ return locally_modified;
+ }
+
+ for (ModelTypeInvalidationMap::const_iterator i = source_info_.types.begin();
+ i != source_info().types.end(); ++i) {
+ locally_modified.Put(i->first);
+ }
+ return locally_modified;
+}
+
+} // namespace sessions
+} // namespace syncer
« no previous file with comments | « sync/sessions/nudge_tracker.h ('k') | sync/sessions/nudge_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698