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

Side by Side Diff: chrome/browser/sync/sessions/sync_session.h

Issue 9158004: Detect sync server communication errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for review comments Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A class representing an attempt to synchronize the local syncable data 5 // A class representing an attempt to synchronize the local syncable data
6 // store with a sync server. A SyncSession instance is passed as a stateful 6 // store with a sync server. A SyncSession instance is passed as a stateful
7 // bundle to and from various SyncerCommands with the goal of converging the 7 // bundle to and from various SyncerCommands with the goal of converging the
8 // client view of data with that of the server. The commands twiddle with 8 // client view of data with that of the server. The commands twiddle with
9 // session status in response to events and hiccups along the way, set and 9 // session status in response to events and hiccups along the way, set and
10 // query session progress with regards to conflict resolution and applying 10 // query session progress with regards to conflict resolution and applying
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Builds a thread-safe and read-only copy of the current session state. 105 // Builds a thread-safe and read-only copy of the current session state.
106 SyncSessionSnapshot TakeSnapshot() const; 106 SyncSessionSnapshot TakeSnapshot() const;
107 107
108 // Builds and sends a snapshot to the session context's listeners. 108 // Builds and sends a snapshot to the session context's listeners.
109 void SendEventNotification(SyncEngineEvent::EventCause cause); 109 void SendEventNotification(SyncEngineEvent::EventCause cause);
110 110
111 // Returns true if this session contains data that should go through the sync 111 // Returns true if this session contains data that should go through the sync
112 // engine again. 112 // engine again.
113 bool HasMoreToSync() const; 113 bool HasMoreToSync() const;
114 114
115 // Returns true if there we did not detect any errors in this session.
116 //
117 // There are many errors that could prevent a sync cycle from succeeding.
118 // These include invalid local state, inability to contact the server,
119 // inability to authenticate with the server, and server errors. What they
120 // have in common is that the we either need to take some action and then
121 // retry the sync cycle or, in the case of transient errors, retry after some
122 // backoff timer has expired. Most importantly, the SyncScheduler should not
123 // assume that the original action that triggered the sync cycle (ie. a nudge
124 // or a notification) has been properly serviced.
125 //
126 // This function also returns false if SyncShare has not been called on this
127 // session yet, or if ResetTransientState() has been called on this session
128 // since the last call to SyncShare.
129 bool Succeeded() const;
130
115 // Collects all state pertaining to how and why |s| originated and unions it 131 // Collects all state pertaining to how and why |s| originated and unions it
116 // with corresponding state in |this|, leaving |s| unchanged. Allows |this| 132 // with corresponding state in |this|, leaving |s| unchanged. Allows |this|
117 // to take on the responsibilities |s| had (e.g. certain data types) in the 133 // to take on the responsibilities |s| had (e.g. certain data types) in the
118 // next SyncShare operation using |this|, rather than needed two separate 134 // next SyncShare operation using |this|, rather than needed two separate
119 // sessions. 135 // sessions.
120 void Coalesce(const SyncSession& session); 136 void Coalesce(const SyncSession& session);
121 137
122 // Compares the routing_info_, workers and payload map with the passed in 138 // Compares the routing_info_, workers and payload map with the passed in
123 // session. Purges types from the above 3 which are not in session. Useful 139 // session. Purges types from the above 3 which are not in session. Useful
124 // to update the sync session when the user has disabled some types from 140 // to update the sync session when the user has disabled some types from
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 236
221 private: 237 private:
222 SyncSession* session_; 238 SyncSession* session_;
223 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); 239 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction);
224 }; 240 };
225 241
226 } // namespace sessions 242 } // namespace sessions
227 } // namespace browser_sync 243 } // namespace browser_sync
228 244
229 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ 245 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/status_controller_unittest.cc ('k') | chrome/browser/sync/sessions/sync_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698