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

Unified Diff: sync/sessions/data_type_tracker.cc

Issue 17052007: sync: Expose sync functionality as functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanups Created 7 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
Index: sync/sessions/data_type_tracker.cc
diff --git a/sync/sessions/data_type_tracker.cc b/sync/sessions/data_type_tracker.cc
index 857b86a0f9f15c22b7a9459d692ab09b7ff7d974..3eabbbe758f959f1811167649bdabd01c44f900a 100644
--- a/sync/sessions/data_type_tracker.cc
+++ b/sync/sessions/data_type_tracker.cc
@@ -4,6 +4,7 @@
#include "sync/sessions/data_type_tracker.h"
+#include "base/logging.h"
#include "sync/sessions/nudge_tracker.h"
namespace syncer {
@@ -73,6 +74,23 @@ std::string DataTypeTracker::GetMostRecentInvalidationPayload() const {
return pending_payloads_.back();
}
+void DataTypeTracker::SetLegacyNotificationHint(
+ sync_pb::DataTypeProgressMarker* progress) const {
+ DCHECK(!IsThrottled())
+ << "We should not make requests if the type is throttled.";
+
+ if (HasPendingInvalidation()) {
+ // The old-style source info can contain only one hint per type. We grab
+ // the most recent, to mimic the old coalescing behaviour.
+ progress->set_notification_hint(GetMostRecentInvalidationPayload());
+ } else if (HasLocalChangePending()) {
+ // The old-style source info sent up an empty string (as opposed to
+ // nothing at all) when the type was locally nudged, but had not received
+ // any invalidations.
+ progress->set_notification_hint("");
+ }
+}
+
void DataTypeTracker::FillGetUpdatesTriggersMessage(
sync_pb::GetUpdateTriggers* msg) const {
// Fill the list of payloads, if applicable. The payloads must be ordered

Powered by Google App Engine
This is Rietveld 408576698