| 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 #include "chrome/browser/sync/sessions/status_controller.h" | 5 #include "chrome/browser/sync/sessions/status_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/sync/sessions/sync_error.h" |
| 10 #include "chrome/browser/sync/syncable/model_type.h" | 11 #include "chrome/browser/sync/syncable/model_type.h" |
| 11 | 12 |
| 12 namespace browser_sync { | 13 namespace browser_sync { |
| 13 namespace sessions { | 14 namespace sessions { |
| 14 | 15 |
| 15 using syncable::FIRST_REAL_MODEL_TYPE; | 16 using syncable::FIRST_REAL_MODEL_TYPE; |
| 16 using syncable::MODEL_TYPE_COUNT; | 17 using syncable::MODEL_TYPE_COUNT; |
| 17 | 18 |
| 18 StatusController::StatusController(const ModelSafeRoutingInfo& routes) | 19 StatusController::StatusController(const ModelSafeRoutingInfo& routes) |
| 19 : shared_(&is_dirty_), | 20 : shared_(&is_dirty_), |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 146 } |
| 146 | 147 |
| 147 void StatusController::increment_num_local_overwrites() { | 148 void StatusController::increment_num_local_overwrites() { |
| 148 shared_.syncer_status.mutate()->num_local_overwrites++; | 149 shared_.syncer_status.mutate()->num_local_overwrites++; |
| 149 } | 150 } |
| 150 | 151 |
| 151 void StatusController::increment_num_server_overwrites() { | 152 void StatusController::increment_num_server_overwrites() { |
| 152 shared_.syncer_status.mutate()->num_server_overwrites++; | 153 shared_.syncer_status.mutate()->num_server_overwrites++; |
| 153 } | 154 } |
| 154 | 155 |
| 156 void StatusController::set_sync_error(const SyncError& error) { |
| 157 (*(shared_.sync_error.mutate())) = error; |
| 158 } |
| 159 |
| 155 void StatusController::set_commit_set(const OrderedCommitSet& commit_set) { | 160 void StatusController::set_commit_set(const OrderedCommitSet& commit_set) { |
| 156 DCHECK(!group_restriction_in_effect_); | 161 DCHECK(!group_restriction_in_effect_); |
| 157 shared_.commit_set = commit_set; | 162 shared_.commit_set = commit_set; |
| 158 } | 163 } |
| 159 | 164 |
| 160 void StatusController::update_conflict_sets_built(bool built) { | 165 void StatusController::update_conflict_sets_built(bool built) { |
| 161 shared_.control_params.conflict_sets_built |= built; | 166 shared_.control_params.conflict_sets_built |= built; |
| 162 } | 167 } |
| 163 void StatusController::update_conflicts_resolved(bool resolved) { | 168 void StatusController::update_conflicts_resolved(bool resolved) { |
| 164 shared_.control_params.conflict_sets_built |= resolved; | 169 shared_.control_params.conflict_sets_built |= resolved; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 NOTREACHED(); // Server should always send changes remaining. | 236 NOTREACHED(); // Server should always send changes remaining. |
| 232 return false; // Avoid looping forever. | 237 return false; // Avoid looping forever. |
| 233 } | 238 } |
| 234 // Changes remaining is an estimate, but if it's estimated to be | 239 // Changes remaining is an estimate, but if it's estimated to be |
| 235 // zero, that's firm and we don't have to ask again. | 240 // zero, that's firm and we don't have to ask again. |
| 236 return updates_response().get_updates().changes_remaining() == 0; | 241 return updates_response().get_updates().changes_remaining() == 0; |
| 237 } | 242 } |
| 238 | 243 |
| 239 } // namespace sessions | 244 } // namespace sessions |
| 240 } // namespace browser_sync | 245 } // namespace browser_sync |
| OLD | NEW |