| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 191 |
| 194 void MergeSets(const syncable::Id& set1, const syncable::Id& set2); | 192 void MergeSets(const syncable::Id& set1, const syncable::Id& set2); |
| 195 void CleanupSets(); | 193 void CleanupSets(); |
| 196 | 194 |
| 197 private: | 195 private: |
| 198 // TODO(sync): move away from sets if it makes more sense. | 196 // TODO(sync): move away from sets if it makes more sense. |
| 199 std::set<syncable::Id> conflicting_item_ids_; | 197 std::set<syncable::Id> conflicting_item_ids_; |
| 200 std::map<syncable::Id, ConflictSet*> id_to_conflict_set_; | 198 std::map<syncable::Id, ConflictSet*> id_to_conflict_set_; |
| 201 std::set<ConflictSet*> conflict_sets_; | 199 std::set<ConflictSet*> conflict_sets_; |
| 202 | 200 |
| 203 // Nonblocking conflicts are those which should not block forward progress | 201 // Nonblocking conflicts are not processed by the conflict resolver, but |
| 204 // (they will not result in the syncer being stuck). This currently only | 202 // they will be processed in the APPLY_UDPATES_TO_RESOLVE_CONFLICTS step. |
| 205 // includes entries we cannot yet decrypt because the passphrase has not | |
| 206 // arrived. | |
| 207 // With nonblocking conflicts, we want to go to the syncer's | |
| 208 // APPLY_UPDATES_TO_RESOLVE_CONFLICTS step, but we want to ignore them after. | |
| 209 // Because they are not passed to the conflict resolver, they do not trigger | |
| 210 // syncer_stuck. | |
| 211 // TODO(zea): at some point we may have nonblocking conflicts that should be | |
| 212 // resolved in the conflict resolver. We'll need to change this then. | |
| 213 // See http://crbug.com/76596. | |
| 214 std::set<syncable::Id> nonblocking_conflicting_item_ids_; | 203 std::set<syncable::Id> nonblocking_conflicting_item_ids_; |
| 215 | 204 |
| 216 // Whether a conflicting item was added or removed since | 205 // Whether a conflicting item was added or removed since |
| 217 // the last call to reset_progress_changed(), if any. In practice this | 206 // the last call to reset_progress_changed(), if any. In practice this |
| 218 // points to StatusController::is_dirty_. | 207 // points to StatusController::is_dirty_. |
| 219 bool* dirty_; | 208 bool* dirty_; |
| 220 }; | 209 }; |
| 221 | 210 |
| 222 typedef std::pair<VerifyResult, sync_pb::SyncEntity> VerifiedUpdate; | 211 typedef std::pair<VerifyResult, sync_pb::SyncEntity> VerifiedUpdate; |
| 223 typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate; | 212 typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 ~PerModelSafeGroupState(); | 329 ~PerModelSafeGroupState(); |
| 341 | 330 |
| 342 UpdateProgress update_progress; | 331 UpdateProgress update_progress; |
| 343 ConflictProgress conflict_progress; | 332 ConflictProgress conflict_progress; |
| 344 }; | 333 }; |
| 345 | 334 |
| 346 } // namespace sessions | 335 } // namespace sessions |
| 347 } // namespace browser_sync | 336 } // namespace browser_sync |
| 348 | 337 |
| 349 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ | 338 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ |
| OLD | NEW |