| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 | |
| 6 // state tracking on behalf of a SyncCycle. | |
| 7 // | |
| 8 // This object may be accessed from many different threads. It will be accessed | |
| 9 // most often from the syncer thread. However, when update application is in | |
| 10 // progress it may also be accessed from the worker threads. This is safe | |
| 11 // because only one of them will run at a time, and the syncer thread will be | |
| 12 // blocked until update application completes. | |
| 13 // | |
| 14 // This object contains only global state. None of its members are per model | |
| 15 // type counters. | |
| 16 | |
| 17 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ |
| 18 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ |
| 19 | 7 |
| 20 #include <map> | 8 #include <map> |
| 21 #include <vector> | 9 #include <vector> |
| 22 | 10 |
| 23 #include "base/logging.h" | 11 #include "base/logging.h" |
| 24 #include "base/macros.h" | 12 #include "base/macros.h" |
| 25 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 26 #include "components/sync/engine/cycle/model_neutral_state.h" | 14 #include "components/sync/engine/cycle/model_neutral_state.h" |
| 27 #include "components/sync/engine/model_safe_worker.h" | 15 #include "components/sync/engine/model_safe_worker.h" |
| 28 | 16 |
| 29 namespace syncer { | 17 namespace syncer { |
| 30 | 18 |
| 19 // StatusController handles all counter and status related number crunching and |
| 20 // state tracking on behalf of a SyncCycle. |
| 21 // |
| 22 // This object may be accessed from many different threads. It will be accessed |
| 23 // most often from the syncer thread. However, when update application is in |
| 24 // progress it may also be accessed from the worker threads. This is safe |
| 25 // because only one of them will run at a time, and the syncer thread will be |
| 26 // blocked until update application completes. |
| 27 // |
| 28 // This object contains only global state. None of its members are per model |
| 29 // type counters. |
| 31 class StatusController { | 30 class StatusController { |
| 32 public: | 31 public: |
| 33 StatusController(); | 32 StatusController(); |
| 34 ~StatusController(); | 33 ~StatusController(); |
| 35 | 34 |
| 36 // The types included in the get updates and commit client to server requests. | 35 // The types included in the get updates and commit client to server requests. |
| 37 const ModelTypeSet get_updates_request_types() const; | 36 const ModelTypeSet get_updates_request_types() const; |
| 38 void set_get_updates_request_types(ModelTypeSet value); | 37 void set_get_updates_request_types(ModelTypeSet value); |
| 39 const ModelTypeSet commit_request_types() const; | 38 const ModelTypeSet commit_request_types() const; |
| 40 void set_commit_request_types(ModelTypeSet value); | 39 void set_commit_request_types(ModelTypeSet value); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // If a poll was performed, the time it finished. Not set if not poll was | 100 // If a poll was performed, the time it finished. Not set if not poll was |
| 102 // performed. | 101 // performed. |
| 103 base::Time poll_finish_time_; | 102 base::Time poll_finish_time_; |
| 104 | 103 |
| 105 DISALLOW_COPY_AND_ASSIGN(StatusController); | 104 DISALLOW_COPY_AND_ASSIGN(StatusController); |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 } // namespace syncer | 107 } // namespace syncer |
| 109 | 108 |
| 110 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ | 109 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_STATUS_CONTROLLER_H_ |
| OLD | NEW |