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 // StatusController handles all counter and status related number crunching and | 5 // StatusController handles all counter and status related number crunching and |
6 // state tracking on behalf of a SyncSession. It 'controls' the model data | 6 // state tracking on behalf of a SyncSession. It 'controls' the model data |
7 // defined in session_state.h. The most important feature of StatusController | 7 // defined in session_state.h. The most important feature of StatusController |
8 // is the ScopedModelSafetyRestriction. When one of these is active, the | 8 // is the ScopedModelSafetyRestriction. When one of these is active, the |
9 // underlying data set exposed via accessors is swapped out to the appropriate | 9 // underlying data set exposed via accessors is swapped out to the appropriate |
10 // set for the restricted ModelSafeGroup behind the scenes. For example, if | 10 // set for the restricted ModelSafeGroup behind the scenes. For example, if |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return &shared_.updates_response; | 102 return &shared_.updates_response; |
103 } | 103 } |
104 | 104 |
105 // Errors and SyncerStatus. | 105 // Errors and SyncerStatus. |
106 const ErrorCounters& error_counters() const { | 106 const ErrorCounters& error_counters() const { |
107 return shared_.error_counters.value(); | 107 return shared_.error_counters.value(); |
108 } | 108 } |
109 const SyncerStatus& syncer_status() const { | 109 const SyncerStatus& syncer_status() const { |
110 return shared_.syncer_status.value(); | 110 return shared_.syncer_status.value(); |
111 } | 111 } |
| 112 SyncProtocolError sync_protocol_error() const { |
| 113 return shared_.sync_protocol_error.value(); |
| 114 } |
112 | 115 |
113 // Changelog related state. | 116 // Changelog related state. |
114 int64 num_server_changes_remaining() const { | 117 int64 num_server_changes_remaining() const { |
115 return shared_.num_server_changes_remaining.value(); | 118 return shared_.num_server_changes_remaining.value(); |
116 } | 119 } |
117 | 120 |
118 // Commit path data. | 121 // Commit path data. |
119 const std::vector<syncable::Id>& commit_ids() const { | 122 const std::vector<syncable::Id>& commit_ids() const { |
120 DCHECK(!group_restriction_in_effect_) << "Group restriction in effect!"; | 123 DCHECK(!group_restriction_in_effect_) << "Group restriction in effect!"; |
121 return shared_.commit_set.GetAllCommitIds(); | 124 return shared_.commit_set.GetAllCommitIds(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void set_syncer_stuck(bool syncer_stuck); | 225 void set_syncer_stuck(bool syncer_stuck); |
223 void set_num_successful_bookmark_commits(int value); | 226 void set_num_successful_bookmark_commits(int value); |
224 void increment_num_successful_commits(); | 227 void increment_num_successful_commits(); |
225 void increment_num_successful_bookmark_commits(); | 228 void increment_num_successful_bookmark_commits(); |
226 void increment_num_updates_downloaded_by(int value); | 229 void increment_num_updates_downloaded_by(int value); |
227 void increment_num_tombstone_updates_downloaded_by(int value); | 230 void increment_num_tombstone_updates_downloaded_by(int value); |
228 void set_types_needing_local_migration(const syncable::ModelTypeSet& types); | 231 void set_types_needing_local_migration(const syncable::ModelTypeSet& types); |
229 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); | 232 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); |
230 void increment_num_local_overwrites(); | 233 void increment_num_local_overwrites(); |
231 void increment_num_server_overwrites(); | 234 void increment_num_server_overwrites(); |
| 235 void set_sync_protocol_error(const SyncProtocolError& error); |
232 | 236 |
233 void set_commit_set(const OrderedCommitSet& commit_set); | 237 void set_commit_set(const OrderedCommitSet& commit_set); |
234 void update_conflict_sets_built(bool built); | 238 void update_conflict_sets_built(bool built); |
235 void update_conflicts_resolved(bool resolved); | 239 void update_conflicts_resolved(bool resolved); |
236 void reset_conflicts_resolved(); | 240 void reset_conflicts_resolved(); |
237 void set_items_committed(); | 241 void set_items_committed(); |
238 | 242 |
239 void SetSyncInProgressAndUpdateStartTime(bool sync_in_progress); | 243 void SetSyncInProgressAndUpdateStartTime(bool sync_in_progress); |
240 | 244 |
241 private: | 245 private: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 292 } |
289 private: | 293 private: |
290 StatusController* status_; | 294 StatusController* status_; |
291 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 295 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
292 }; | 296 }; |
293 | 297 |
294 } | 298 } |
295 } | 299 } |
296 | 300 |
297 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 301 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
OLD | NEW |