OLD | NEW |
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 // The 'sessions' namespace comprises all the pieces of state that are | 5 // The 'sessions' namespace comprises all the pieces of state that are |
6 // combined to form a SyncSession instance. In that way, it can be thought of | 6 // combined to form a SyncSession instance. In that way, it can be thought of |
7 // as an extension of the SyncSession type itself. Session scoping gives | 7 // as an extension of the SyncSession type itself. Session scoping gives |
8 // context to things like "conflict progress", "update progress", etc, and the | 8 // context to things like "conflict progress", "update progress", etc, and the |
9 // separation this file provides allows clients to only include the parts they | 9 // separation this file provides allows clients to only include the parts they |
10 // need rather than the entire session stack. | 10 // need rather than the entire session stack. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Data pertaining to the status of an active Syncer object. | 58 // Data pertaining to the status of an active Syncer object. |
59 struct SyncerStatus { | 59 struct SyncerStatus { |
60 SyncerStatus(); | 60 SyncerStatus(); |
61 ~SyncerStatus(); | 61 ~SyncerStatus(); |
62 | 62 |
63 // Caller takes ownership of the returned dictionary. | 63 // Caller takes ownership of the returned dictionary. |
64 base::DictionaryValue* ToValue() const; | 64 base::DictionaryValue* ToValue() const; |
65 | 65 |
66 // True when we get such an INVALID_STORE error from the server. | 66 // True when we get such an INVALID_STORE error from the server. |
67 bool invalid_store; | 67 bool invalid_store; |
68 // True iff we're stuck. | |
69 bool syncer_stuck; | |
70 int num_successful_commits; | 68 int num_successful_commits; |
71 // This is needed for monitoring extensions activity. | 69 // This is needed for monitoring extensions activity. |
72 int num_successful_bookmark_commits; | 70 int num_successful_bookmark_commits; |
73 | 71 |
74 // Download event counters. | 72 // Download event counters. |
75 int num_updates_downloaded_total; | 73 int num_updates_downloaded_total; |
76 int num_tombstone_updates_downloaded_total; | 74 int num_tombstone_updates_downloaded_total; |
77 | 75 |
78 // If the syncer encountered a MIGRATION_DONE code, these are the types that | 76 // If the syncer encountered a MIGRATION_DONE code, these are the types that |
79 // the client must now "migrate", by purging and re-downloading all updates. | 77 // the client must now "migrate", by purging and re-downloading all updates. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 186 |
189 void MergeSets(const syncable::Id& set1, const syncable::Id& set2); | 187 void MergeSets(const syncable::Id& set1, const syncable::Id& set2); |
190 void CleanupSets(); | 188 void CleanupSets(); |
191 | 189 |
192 private: | 190 private: |
193 // TODO(sync): move away from sets if it makes more sense. | 191 // TODO(sync): move away from sets if it makes more sense. |
194 std::set<syncable::Id> conflicting_item_ids_; | 192 std::set<syncable::Id> conflicting_item_ids_; |
195 std::map<syncable::Id, ConflictSet*> id_to_conflict_set_; | 193 std::map<syncable::Id, ConflictSet*> id_to_conflict_set_; |
196 std::set<ConflictSet*> conflict_sets_; | 194 std::set<ConflictSet*> conflict_sets_; |
197 | 195 |
198 // Nonblocking conflicts are those which should not block forward progress | 196 // Nonblocking conflicts are not processed by the conflict resolver, but |
199 // (they will not result in the syncer being stuck). This currently only | 197 // they will be processed in the APPLY_UDPATES_TO_RESOLVE_CONFLICTS step. |
200 // includes entries we cannot yet decrypt because the passphrase has not | |
201 // arrived. | |
202 // With nonblocking conflicts, we want to go to the syncer's | |
203 // APPLY_UPDATES_TO_RESOLVE_CONFLICTS step, but we want to ignore them after. | |
204 // Because they are not passed to the conflict resolver, they do not trigger | |
205 // syncer_stuck. | |
206 // TODO(zea): at some point we may have nonblocking conflicts that should be | |
207 // resolved in the conflict resolver. We'll need to change this then. | |
208 // See http://crbug.com/76596. | |
209 std::set<syncable::Id> nonblocking_conflicting_item_ids_; | 198 std::set<syncable::Id> nonblocking_conflicting_item_ids_; |
210 | 199 |
211 // Whether a conflicting item was added or removed since | 200 // Whether a conflicting item was added or removed since |
212 // the last call to reset_progress_changed(), if any. In practice this | 201 // the last call to reset_progress_changed(), if any. In practice this |
213 // points to StatusController::is_dirty_. | 202 // points to StatusController::is_dirty_. |
214 bool* dirty_; | 203 bool* dirty_; |
215 }; | 204 }; |
216 | 205 |
217 typedef std::pair<VerifyResult, sync_pb::SyncEntity> VerifiedUpdate; | 206 typedef std::pair<VerifyResult, sync_pb::SyncEntity> VerifiedUpdate; |
218 typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate; | 207 typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 ~PerModelSafeGroupState(); | 324 ~PerModelSafeGroupState(); |
336 | 325 |
337 UpdateProgress update_progress; | 326 UpdateProgress update_progress; |
338 ConflictProgress conflict_progress; | 327 ConflictProgress conflict_progress; |
339 }; | 328 }; |
340 | 329 |
341 } // namespace sessions | 330 } // namespace sessions |
342 } // namespace browser_sync | 331 } // namespace browser_sync |
343 | 332 |
344 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ | 333 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ |
OLD | NEW |