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 11 matching lines...) Expand all Loading... |
22 // assumes one single thread is accessing this class for each unique | 22 // assumes one single thread is accessing this class for each unique |
23 // ModelSafeGroup, and also only one single thread (in practice, the | 23 // ModelSafeGroup, and also only one single thread (in practice, the |
24 // SyncerThread) responsible for all "shared" access when no restriction is in | 24 // SyncerThread) responsible for all "shared" access when no restriction is in |
25 // place. Thus, every bit of data is to be accessed mutually exclusively with | 25 // place. Thus, every bit of data is to be accessed mutually exclusively with |
26 // respect to threads. | 26 // respect to threads. |
27 // | 27 // |
28 // StatusController can also track if changes occur to certain parts of state | 28 // StatusController can also track if changes occur to certain parts of state |
29 // so that various parts of the sync engine can avoid broadcasting | 29 // so that various parts of the sync engine can avoid broadcasting |
30 // notifications if no changes occurred. | 30 // notifications if no changes occurred. |
31 | 31 |
32 #ifndef CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 32 #ifndef SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
33 #define CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 33 #define SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
34 #pragma once | 34 #pragma once |
35 | 35 |
| 36 #include <map> |
36 #include <vector> | 37 #include <vector> |
37 #include <map> | |
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 "chrome/browser/sync/sessions/ordered_commit_set.h" | 42 #include "sync/sessions/ordered_commit_set.h" |
43 #include "chrome/browser/sync/sessions/session_state.h" | 43 #include "sync/sessions/session_state.h" |
44 | 44 |
45 namespace browser_sync { | 45 namespace browser_sync { |
46 namespace sessions { | 46 namespace sessions { |
47 | 47 |
48 class StatusController { | 48 class StatusController { |
49 public: | 49 public: |
50 explicit StatusController(const ModelSafeRoutingInfo& routes); | 50 explicit StatusController(const ModelSafeRoutingInfo& routes); |
51 ~StatusController(); | 51 ~StatusController(); |
52 | 52 |
53 // Returns true if some portion of the session state has changed (is dirty) | 53 // Returns true if some portion of the session state has changed (is dirty) |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 status_->group_restriction_in_effect_ = false; | 287 status_->group_restriction_in_effect_ = false; |
288 } | 288 } |
289 private: | 289 private: |
290 StatusController* status_; | 290 StatusController* status_; |
291 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); | 291 DISALLOW_COPY_AND_ASSIGN(ScopedModelSafeGroupRestriction); |
292 }; | 292 }; |
293 | 293 |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 #endif // CHROME_BROWSER_SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 297 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
OLD | NEW |