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 | 5 // StatusController handles all counter and status related number crunching and |
6 // state tracking on behalf of a SyncSession. | 6 // state tracking on behalf of a SyncSession. |
7 // | 7 // |
8 // This object may be accessed from many different threads. It will be accessed | 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 | 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 | 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 | 11 // because only one of them will run at a time, and the syncer thread will be |
12 // blocked until update application completes. | 12 // blocked until update application completes. |
13 // | 13 // |
14 // This object contains only global state. None of its members are per model | 14 // This object contains only global state. None of its members are per model |
15 // type counters. | 15 // type counters. |
16 | 16 |
17 #ifndef SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 17 #ifndef COMPONENTS_SYNC_SESSIONS_IMPL_STATUS_CONTROLLER_H_ |
18 #define SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 18 #define COMPONENTS_SYNC_SESSIONS_IMPL_STATUS_CONTROLLER_H_ |
19 | 19 |
20 #include <map> | 20 #include <map> |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/macros.h" | 24 #include "base/macros.h" |
25 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
27 #include "sync/base/sync_export.h" | 27 #include "components/sync/base/sync_export.h" |
28 #include "sync/internal_api/public/engine/model_safe_worker.h" | 28 #include "components/sync/engine/model_safe_worker.h" |
29 #include "sync/internal_api/public/sessions/model_neutral_state.h" | 29 #include "components/sync/sessions/model_neutral_state.h" |
30 | 30 |
31 namespace syncer { | 31 namespace syncer { |
32 namespace sessions { | 32 namespace sessions { |
33 | 33 |
34 class SYNC_EXPORT StatusController { | 34 class SYNC_EXPORT StatusController { |
35 public: | 35 public: |
36 StatusController(); | 36 StatusController(); |
37 ~StatusController(); | 37 ~StatusController(); |
38 | 38 |
39 // The types included in the get updates and commit client to server requests. | 39 // The types included in the get updates and commit client to server requests. |
(...skipping 10 matching lines...) Expand all Loading... |
50 // Aggregate sum of all conflicting items over all conflict types. | 50 // Aggregate sum of all conflicting items over all conflict types. |
51 int TotalNumConflictingItems() const; | 51 int TotalNumConflictingItems() const; |
52 | 52 |
53 // Number of successfully applied updates. | 53 // Number of successfully applied updates. |
54 int num_updates_applied() const; | 54 int num_updates_applied() const; |
55 | 55 |
56 int num_server_overwrites() const; | 56 int num_server_overwrites() const; |
57 int num_local_overwrites() const; | 57 int num_local_overwrites() const; |
58 | 58 |
59 // The time at which we started the first sync cycle in this session. | 59 // The time at which we started the first sync cycle in this session. |
60 base::Time sync_start_time() const { | 60 base::Time sync_start_time() const { return sync_start_time_; } |
61 return sync_start_time_; | |
62 } | |
63 | 61 |
64 // If a poll was performed in this session, the time at which it finished. | 62 // If a poll was performed in this session, the time at which it finished. |
65 // Not set if no poll was performed. | 63 // Not set if no poll was performed. |
66 base::Time poll_finish_time() const { | 64 base::Time poll_finish_time() const { return poll_finish_time_; } |
67 return poll_finish_time_; | |
68 } | |
69 | 65 |
70 const ModelNeutralState& model_neutral_state() const { | 66 const ModelNeutralState& model_neutral_state() const { |
71 return model_neutral_; | 67 return model_neutral_; |
72 } | 68 } |
73 | 69 |
74 SyncerError last_get_key_result() const; | 70 SyncerError last_get_key_result() const; |
75 | 71 |
76 // Download counters. | 72 // Download counters. |
77 void increment_num_updates_downloaded_by(int value); | 73 void increment_num_updates_downloaded_by(int value); |
78 void increment_num_tombstone_updates_downloaded_by(int value); | 74 void increment_num_tombstone_updates_downloaded_by(int value); |
(...skipping 29 matching lines...) Expand all Loading... |
108 // If a poll was performed, the time it finished. Not set if not poll was | 104 // If a poll was performed, the time it finished. Not set if not poll was |
109 // performed. | 105 // performed. |
110 base::Time poll_finish_time_; | 106 base::Time poll_finish_time_; |
111 | 107 |
112 DISALLOW_COPY_AND_ASSIGN(StatusController); | 108 DISALLOW_COPY_AND_ASSIGN(StatusController); |
113 }; | 109 }; |
114 | 110 |
115 } // namespace sessions | 111 } // namespace sessions |
116 } // namespace syncer | 112 } // namespace syncer |
117 | 113 |
118 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 114 #endif // COMPONENTS_SYNC_SESSIONS_IMPL_STATUS_CONTROLLER_H_ |
OLD | NEW |