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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void set_updates_request_types(const syncable::ModelTypeBitSet& value) { | 95 void set_updates_request_types(const syncable::ModelTypeBitSet& value) { |
96 shared_.updates_request_types = value; | 96 shared_.updates_request_types = value; |
97 } | 97 } |
98 const ClientToServerResponse& updates_response() const { | 98 const ClientToServerResponse& updates_response() const { |
99 return shared_.updates_response; | 99 return shared_.updates_response; |
100 } | 100 } |
101 ClientToServerResponse* mutable_updates_response() { | 101 ClientToServerResponse* mutable_updates_response() { |
102 return &shared_.updates_response; | 102 return &shared_.updates_response; |
103 } | 103 } |
104 | 104 |
| 105 void set_last_download_updates_result(const SyncOperationResult result) { |
| 106 shared_.last_download_updates_result = result; |
| 107 } |
| 108 void set_last_post_commit_result(const SyncOperationResult result) { |
| 109 shared_.last_post_commit_result = result; |
| 110 } |
| 111 void set_last_clear_data_result(const SyncOperationResult result) { |
| 112 shared_.last_clear_data_result = result; |
| 113 } |
| 114 SyncOperationResult last_download_updates_result() const { |
| 115 return shared_.last_download_updates_result; |
| 116 } |
| 117 SyncOperationResult last_post_commit_result() const { |
| 118 return shared_.last_post_commit_result; |
| 119 } |
| 120 SyncOperationResult last_clear_data_result() const { |
| 121 return shared_.last_clear_data_result; |
| 122 } |
| 123 |
105 // Errors and SyncerStatus. | 124 // Errors and SyncerStatus. |
106 const ErrorCounters& error() const { | 125 const ErrorCounters& error() const { |
107 return shared_.error.value(); | 126 return shared_.error.value(); |
108 } | 127 } |
109 const SyncerStatus& syncer_status() const { | 128 const SyncerStatus& syncer_status() const { |
110 return shared_.syncer_status.value(); | 129 return shared_.syncer_status.value(); |
111 } | 130 } |
112 | 131 |
113 // Changelog related state. | 132 // Changelog related state. |
114 int64 num_server_changes_remaining() const { | 133 int64 num_server_changes_remaining() const { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void set_syncer_stuck(bool syncer_stuck); | 241 void set_syncer_stuck(bool syncer_stuck); |
223 void set_num_successful_bookmark_commits(int value); | 242 void set_num_successful_bookmark_commits(int value); |
224 void increment_num_successful_commits(); | 243 void increment_num_successful_commits(); |
225 void increment_num_successful_bookmark_commits(); | 244 void increment_num_successful_bookmark_commits(); |
226 void increment_num_updates_downloaded_by(int value); | 245 void increment_num_updates_downloaded_by(int value); |
227 void increment_num_tombstone_updates_downloaded_by(int value); | 246 void increment_num_tombstone_updates_downloaded_by(int value); |
228 void set_types_needing_local_migration(const syncable::ModelTypeSet& types); | 247 void set_types_needing_local_migration(const syncable::ModelTypeSet& types); |
229 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); | 248 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); |
230 void increment_num_local_overwrites(); | 249 void increment_num_local_overwrites(); |
231 void increment_num_server_overwrites(); | 250 void increment_num_server_overwrites(); |
232 void set_sync_protocol_error(const SyncProtocolError& error); | 251 void set_sync_protocol_error(const SyncOperationResult& error); |
233 | 252 |
234 void set_commit_set(const OrderedCommitSet& commit_set); | 253 void set_commit_set(const OrderedCommitSet& commit_set); |
235 void update_conflict_sets_built(bool built); | 254 void update_conflict_sets_built(bool built); |
236 void update_conflicts_resolved(bool resolved); | 255 void update_conflicts_resolved(bool resolved); |
237 void reset_conflicts_resolved(); | 256 void reset_conflicts_resolved(); |
238 void set_items_committed(); | 257 void set_items_committed(); |
239 | 258 |
240 void SetSyncInProgressAndUpdateStartTime(bool sync_in_progress); | 259 void SetSyncInProgressAndUpdateStartTime(bool sync_in_progress); |
241 | 260 |
242 private: | 261 private: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 308 } |
290 private: | 309 private: |
291 StatusController* status_; | 310 StatusController* status_; |
292 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 311 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
293 }; | 312 }; |
294 | 313 |
295 } | 314 } |
296 } | 315 } |
297 | 316 |
298 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 317 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
OLD | NEW |