| 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 // 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 25 matching lines...) Expand all Loading... |
| 36 #include <map> | 36 #include <map> |
| 37 #include <vector> | 37 #include <vector> |
| 38 | 38 |
| 39 #include "base/logging.h" | 39 #include "base/logging.h" |
| 40 #include "base/stl_util.h" | 40 #include "base/stl_util.h" |
| 41 #include "base/time.h" | 41 #include "base/time.h" |
| 42 #include "sync/internal_api/public/sessions/model_neutral_state.h" | 42 #include "sync/internal_api/public/sessions/model_neutral_state.h" |
| 43 #include "sync/sessions/ordered_commit_set.h" | 43 #include "sync/sessions/ordered_commit_set.h" |
| 44 #include "sync/sessions/session_state.h" | 44 #include "sync/sessions/session_state.h" |
| 45 | 45 |
| 46 namespace csync { | 46 namespace syncer { |
| 47 namespace sessions { | 47 namespace sessions { |
| 48 | 48 |
| 49 class StatusController { | 49 class StatusController { |
| 50 public: | 50 public: |
| 51 explicit StatusController(const ModelSafeRoutingInfo& routes); | 51 explicit StatusController(const ModelSafeRoutingInfo& routes); |
| 52 ~StatusController(); | 52 ~StatusController(); |
| 53 | 53 |
| 54 // Progress counters. All const methods may return NULL if the | 54 // Progress counters. All const methods may return NULL if the |
| 55 // progress structure doesn't exist, but all non-const methods | 55 // progress structure doesn't exist, but all non-const methods |
| 56 // auto-create. | 56 // auto-create. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 ~ScopedModelSafeGroupRestriction() { | 228 ~ScopedModelSafeGroupRestriction() { |
| 229 DCHECK(status_->group_restriction_in_effect_); | 229 DCHECK(status_->group_restriction_in_effect_); |
| 230 status_->group_restriction_in_effect_ = false; | 230 status_->group_restriction_in_effect_ = false; |
| 231 } | 231 } |
| 232 private: | 232 private: |
| 233 StatusController* status_; | 233 StatusController* status_; |
| 234 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 234 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 } | 237 } // namespace sessions |
| 238 } | 238 } // namespace syncer |
| 239 | 239 |
| 240 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 240 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
| OLD | NEW |