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

Unified Diff: sync/sessions/sync_session.h

Issue 11342008: Revert 164565 - sync: make scheduling logic and job ownership more obvious. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1311/src/
Patch Set: Created 8 years, 2 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/session_state_unittest.cc ('k') | sync/sessions/sync_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session.h
===================================================================
--- sync/sessions/sync_session.h (revision 164641)
+++ sync/sessions/sync_session.h (working copy)
@@ -112,12 +112,26 @@
// engine again.
bool HasMoreToSync() const;
- // Returns true if we reached the server. Note that "reaching the server"
- // here means that from an HTTP perspective, we succeeded (HTTP 200). The
- // server **MAY** have returned a sync protocol error.
- // See SERVER_RETURN_* in the SyncerError enum for values.
- bool DidReachServer() const;
+ // Returns true if we completely ran the session without errors.
+ //
+ // There are many errors that could prevent a sync cycle from succeeding.
+ // These include invalid local state, inability to contact the server,
+ // inability to authenticate with the server, and server errors. What they
+ // have in common is that the we either need to take some action and then
+ // retry the sync cycle or, in the case of transient errors, retry after some
+ // backoff timer has expired. Most importantly, the SyncScheduler should not
+ // assume that the original action that triggered the sync cycle (ie. a nudge
+ // or a notification) has been properly serviced.
+ //
+ // This function also returns false if SyncShare has not been called on this
+ // session yet, or if ResetTransientState() has been called on this session
+ // since the last call to SyncShare.
+ bool Succeeded() const;
+ // Returns true if we reached the server successfully and the server did not
+ // return any error codes. Returns false if no connection was attempted.
+ bool SuccessfullyReachedServer() const;
+
// Collects all state pertaining to how and why |s| originated and unions it
// with corresponding state in |this|, leaving |s| unchanged. Allows |this|
// to take on the responsibilities |s| had (e.g. certain data types) in the
@@ -125,13 +139,11 @@
// sessions.
void Coalesce(const SyncSession& session);
- // Compares the routing_info_, workers and payload map with those passed in.
- // Purges types from the above 3 which are not present in latest. Useful
+ // Compares the routing_info_, workers and payload map with the passed in
+ // session. Purges types from the above 3 which are not in session. Useful
// to update the sync session when the user has disabled some types from
// syncing.
- void RebaseRoutingInfoWithLatest(
- const ModelSafeRoutingInfo& routing_info,
- const std::vector<ModelSafeWorker*>& workers);
+ void RebaseRoutingInfoWithLatest(const SyncSession& session);
// Should be called any time |this| is being re-used in a new call to
// SyncShare (e.g., HasMoreToSync returned true).
@@ -165,6 +177,9 @@
// Returns the set of enabled groups that have conflicts.
std::set<ModelSafeGroup> GetEnabledGroupsWithConflicts() const;
+ // Mark the session has having finished all the sync steps it needed.
+ void SetFinished();
+
private:
// Extend the encapsulation boundary to utilities for internal member
// assignments. This way, the scope of these actions is explicit, they can't
@@ -202,6 +217,10 @@
// |routing_info_|.
std::set<ModelSafeGroup> enabled_groups_;
+ // Whether this session has reached its last step or not. Gets reset on each
+ // new cycle (via PrepareForAnotherSyncCycle).
+ bool finished_;
+
DISALLOW_COPY_AND_ASSIGN(SyncSession);
};
« no previous file with comments | « sync/sessions/session_state_unittest.cc ('k') | sync/sessions/sync_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698