| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 ClientToServerMessage* mutable_commit_message() { | 81 ClientToServerMessage* mutable_commit_message() { |
| 82 return &shared_.commit_message; | 82 return &shared_.commit_message; |
| 83 } | 83 } |
| 84 const ClientToServerResponse& commit_response() const { | 84 const ClientToServerResponse& commit_response() const { |
| 85 return shared_.commit_response; | 85 return shared_.commit_response; |
| 86 } | 86 } |
| 87 ClientToServerResponse* mutable_commit_response() { | 87 ClientToServerResponse* mutable_commit_response() { |
| 88 return &shared_.commit_response; | 88 return &shared_.commit_response; |
| 89 } | 89 } |
| 90 const syncable::MultiTypeTimeStamp& updates_request_parameters() const { | 90 const syncable::ModelTypeBitSet& updates_request_types() const { |
| 91 return shared_.updates_request_parameters; | 91 return shared_.updates_request_types; |
| 92 } | 92 } |
| 93 void set_updates_request_parameters( | 93 void set_updates_request_types(const syncable::ModelTypeBitSet& value) { |
| 94 const syncable::MultiTypeTimeStamp& value) { | 94 shared_.updates_request_types = value; |
| 95 shared_.updates_request_parameters = value; | |
| 96 } | 95 } |
| 97 const ClientToServerResponse& updates_response() const { | 96 const ClientToServerResponse& updates_response() const { |
| 98 return shared_.updates_response; | 97 return shared_.updates_response; |
| 99 } | 98 } |
| 100 ClientToServerResponse* mutable_updates_response() { | 99 ClientToServerResponse* mutable_updates_response() { |
| 101 return &shared_.updates_response; | 100 return &shared_.updates_response; |
| 102 } | 101 } |
| 103 | 102 |
| 104 // Errors and SyncerStatus. | 103 // Errors and SyncerStatus. |
| 105 const ErrorCounters& error_counters() const { | 104 const ErrorCounters& error_counters() const { |
| 106 return shared_.error_counters.value(); | 105 return shared_.error_counters.value(); |
| 107 } | 106 } |
| 108 const SyncerStatus& syncer_status() const { | 107 const SyncerStatus& syncer_status() const { |
| 109 return shared_.syncer_status.value(); | 108 return shared_.syncer_status.value(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 // Changelog related state. | 111 // Changelog related state. |
| 113 int64 num_server_changes_remaining() const { | 112 int64 num_server_changes_remaining() const { |
| 114 return shared_.num_server_changes_remaining.value(); | 113 return shared_.num_server_changes_remaining.value(); |
| 115 } | 114 } |
| 116 // Aggregate max over all data type timestamps, used for UI reporting. | |
| 117 int64 ComputeMaxLocalTimestamp() const; | |
| 118 | 115 |
| 119 // Commit path data. | 116 // Commit path data. |
| 120 const std::vector<syncable::Id>& commit_ids() const { | 117 const std::vector<syncable::Id>& commit_ids() const { |
| 121 DCHECK(!group_restriction_in_effect_) << "Group restriction in effect!"; | 118 DCHECK(!group_restriction_in_effect_) << "Group restriction in effect!"; |
| 122 return shared_.commit_set.GetAllCommitIds(); | 119 return shared_.commit_set.GetAllCommitIds(); |
| 123 } | 120 } |
| 124 const OrderedCommitSet::Projection& commit_id_projection() { | 121 const OrderedCommitSet::Projection& commit_id_projection() { |
| 125 DCHECK(group_restriction_in_effect_) | 122 DCHECK(group_restriction_in_effect_) |
| 126 << "No group restriction for projection."; | 123 << "No group restriction for projection."; |
| 127 return shared_.commit_set.GetCommitIdProjection(group_restriction_); | 124 return shared_.commit_set.GetCommitIdProjection(group_restriction_); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 196 } |
| 200 | 197 |
| 201 // A toolbelt full of methods for updating counters and flags. | 198 // A toolbelt full of methods for updating counters and flags. |
| 202 void increment_num_conflicting_commits_by(int value); | 199 void increment_num_conflicting_commits_by(int value); |
| 203 void reset_num_conflicting_commits(); | 200 void reset_num_conflicting_commits(); |
| 204 void set_num_consecutive_transient_error_commits(int value); | 201 void set_num_consecutive_transient_error_commits(int value); |
| 205 void increment_num_consecutive_transient_error_commits_by(int value); | 202 void increment_num_consecutive_transient_error_commits_by(int value); |
| 206 void set_num_consecutive_errors(int value); | 203 void set_num_consecutive_errors(int value); |
| 207 void increment_num_consecutive_errors(); | 204 void increment_num_consecutive_errors(); |
| 208 void increment_num_consecutive_errors_by(int value); | 205 void increment_num_consecutive_errors_by(int value); |
| 209 void set_current_download_timestamp(syncable::ModelType model, | |
| 210 int64 current_timestamp); | |
| 211 void set_num_server_changes_remaining(int64 changes_remaining); | 206 void set_num_server_changes_remaining(int64 changes_remaining); |
| 212 void set_invalid_store(bool invalid_store); | 207 void set_invalid_store(bool invalid_store); |
| 213 void set_syncer_stuck(bool syncer_stuck); | 208 void set_syncer_stuck(bool syncer_stuck); |
| 214 void set_syncing(bool syncing); | 209 void set_syncing(bool syncing); |
| 215 void set_num_successful_bookmark_commits(int value); | 210 void set_num_successful_bookmark_commits(int value); |
| 216 void increment_num_successful_commits(); | 211 void increment_num_successful_commits(); |
| 217 void increment_num_successful_bookmark_commits(); | 212 void increment_num_successful_bookmark_commits(); |
| 213 void increment_num_updates_downloaded_by(int value); |
| 214 void increment_num_tombstone_updates_downloaded_by(int value); |
| 218 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); | 215 void set_unsynced_handles(const std::vector<int64>& unsynced_handles); |
| 219 | 216 |
| 220 void set_commit_set(const OrderedCommitSet& commit_set); | 217 void set_commit_set(const OrderedCommitSet& commit_set); |
| 221 void update_conflict_sets_built(bool built); | 218 void update_conflict_sets_built(bool built); |
| 222 void update_conflicts_resolved(bool resolved); | 219 void update_conflicts_resolved(bool resolved); |
| 223 void reset_conflicts_resolved(); | 220 void reset_conflicts_resolved(); |
| 224 void set_items_committed(); | 221 void set_items_committed(); |
| 225 | 222 |
| 226 private: | 223 private: |
| 227 friend class ScopedModelSafeGroupRestriction; | 224 friend class ScopedModelSafeGroupRestriction; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 274 } |
| 278 private: | 275 private: |
| 279 StatusController* status_; | 276 StatusController* status_; |
| 280 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 277 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
| 281 }; | 278 }; |
| 282 | 279 |
| 283 } | 280 } |
| 284 } | 281 } |
| 285 | 282 |
| 286 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 283 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
| OLD | NEW |