summaryrefslogtreecommitdiffstats
path: root/sync/sessions/data_type_tracker.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-03 03:44:20 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-03 03:44:20 +0000
commitde84cfd7c982067cb1e691d2e983ec95e08b9e1b (patch)
tree645dd94ad7ac7fa4dd3ef45b967b0ad23cf1eb89 /sync/sessions/data_type_tracker.cc
parente4784baf717103943f13649a2fd385404d409441 (diff)
downloadchromium_src-de84cfd7c982067cb1e691d2e983ec95e08b9e1b.zip
chromium_src-de84cfd7c982067cb1e691d2e983ec95e08b9e1b.tar.gz
chromium_src-de84cfd7c982067cb1e691d2e983ec95e08b9e1b.tar.bz2
sync: Expose sync functionality as functions
This change is a refactor to clean up ugliness introduced in previous commits and prepare for future features. The most notable change is the removal of "state machine" logic from syncer.cc. This allows us to remove the SyncerSteps enum and related code. The SyncShare function + enum parameters have been replaced with the functions NormalSyncShare(), ConfigureSyncShare() and PollSyncShare(). These changes should make it possible to address crbug.com/109422, and to re-enable commits during poll-triggered sync cycles (if desrired, see r206475). The logic for fetching and applying updates has been modified, too. Since the behaviour of GetUpdates varies depending on the type of cycle (Configure, GetUpdates, or Poll) the logic to build and execute these GetUpdate requests has been split up. This enables us to remove the NudgeTracker from the SyncSession (an ugly hack introduced in r199136). It should make it easier to implement crbug.com/147685. In the interest of keeping this change as small and simple as possible some obvious refactorings have not been intentionally excluded from this CL. For example, the logic around when to send SYNC_CYCLE_ENDED events or when to return true or false frome the SyncShare functions remains very complicated. Untangling that mess would require some non-trivial changes to the SyncScheduler, so they've been deferred until later. BUG=147685,109422 Review URL: https://chromiumcodereview.appspot.com/17052007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions/data_type_tracker.cc')
-rw-r--r--sync/sessions/data_type_tracker.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/sync/sessions/data_type_tracker.cc b/sync/sessions/data_type_tracker.cc
index 857b86a..3eabbbe 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