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

Unified Diff: sync/engine/nudge_tracker.cc

Issue 13743003: sync: Finish the SyncScheduler refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ModelNeutralState forward decl 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
Index: sync/engine/nudge_tracker.cc
diff --git a/sync/engine/nudge_tracker.cc b/sync/engine/nudge_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d5b915404423e3294a24026bfb3219f57a8b266
--- /dev/null
+++ b/sync/engine/nudge_tracker.cc
@@ -0,0 +1,45 @@
+// 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/engine/nudge_tracker.h"
+#include "sync/protocol/sync.pb.h"
+
+namespace syncer {
+
+NudgeTracker::NudgeTracker() { }
+
+NudgeTracker::~NudgeTracker() { }
+
+void NudgeTracker::CoalesceSources(const sessions::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_ = sessions::SyncSourceInfo();
+}
+
+// TODO(rlarocque): This function often reports incorrect results. However, it
tim (not reviewing) 2013/04/15 22:37:49 Is there a bug you can reference that details what
rlarocque 2013/04/16 01:30:26 I created crbug.com/231693, which is sort of relat
+// is compatible with the old behaviour. We would need to make the nudge
+// tracker stop overwriting its own information if we wanted to track this
+// properly and return correct results.
+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 syncer

Powered by Google App Engine
This is Rietveld 408576698