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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int num_server_conflicts() const; | 49 int num_server_conflicts() const; |
50 | 50 |
51 // Aggregate sum of all conflicting items over all conflict types. | 51 // Aggregate sum of all conflicting items over all conflict types. |
52 int TotalNumConflictingItems() const; | 52 int TotalNumConflictingItems() const; |
53 | 53 |
54 // Number of successfully applied updates. | 54 // Number of successfully applied updates. |
55 int num_updates_applied() const; | 55 int num_updates_applied() const; |
56 | 56 |
57 int num_server_overwrites() const; | 57 int num_server_overwrites() const; |
58 | 58 |
| 59 // The time at which we started the first sync cycle in this session. |
59 base::Time sync_start_time() const { | 60 base::Time sync_start_time() const { |
60 // The time at which we sent the first GetUpdates command for this sync. | |
61 return sync_start_time_; | 61 return sync_start_time_; |
62 } | 62 } |
63 | 63 |
| 64 // If a poll was performed in this session, the time at which it finished. |
| 65 // Not set if no poll was performed. |
| 66 base::Time poll_finish_time() const { |
| 67 return poll_finish_time_; |
| 68 } |
| 69 |
64 const ModelNeutralState& model_neutral_state() const { | 70 const ModelNeutralState& model_neutral_state() const { |
65 return model_neutral_; | 71 return model_neutral_; |
66 } | 72 } |
67 | 73 |
68 SyncerError last_get_key_result() const; | 74 SyncerError last_get_key_result() const; |
69 | 75 |
70 // Download counters. | 76 // Download counters. |
71 void increment_num_updates_downloaded_by(int value); | 77 void increment_num_updates_downloaded_by(int value); |
72 void increment_num_tombstone_updates_downloaded_by(int value); | 78 void increment_num_tombstone_updates_downloaded_by(int value); |
73 void increment_num_reflected_updates_downloaded_by(int value); | 79 void increment_num_reflected_updates_downloaded_by(int value); |
(...skipping 10 matching lines...) Expand all Loading... |
84 void increment_num_successful_commits(); | 90 void increment_num_successful_commits(); |
85 void increment_num_successful_bookmark_commits(); | 91 void increment_num_successful_bookmark_commits(); |
86 void set_num_successful_bookmark_commits(int value); | 92 void set_num_successful_bookmark_commits(int value); |
87 | 93 |
88 // Server communication status tracking. | 94 // Server communication status tracking. |
89 void set_last_get_key_result(const SyncerError result); | 95 void set_last_get_key_result(const SyncerError result); |
90 void set_last_download_updates_result(const SyncerError result); | 96 void set_last_download_updates_result(const SyncerError result); |
91 void set_commit_result(const SyncerError result); | 97 void set_commit_result(const SyncerError result); |
92 | 98 |
93 void UpdateStartTime(); | 99 void UpdateStartTime(); |
| 100 void UpdatePollTime(); |
94 | 101 |
95 private: | 102 private: |
96 ModelNeutralState model_neutral_; | 103 ModelNeutralState model_neutral_; |
97 | 104 |
| 105 // Time the last sync cycle began. |
98 base::Time sync_start_time_; | 106 base::Time sync_start_time_; |
99 | 107 |
| 108 // If a poll was performed, the time it finished. Not set if not poll was |
| 109 // performed. |
| 110 base::Time poll_finish_time_; |
| 111 |
100 DISALLOW_COPY_AND_ASSIGN(StatusController); | 112 DISALLOW_COPY_AND_ASSIGN(StatusController); |
101 }; | 113 }; |
102 | 114 |
103 } // namespace sessions | 115 } // namespace sessions |
104 } // namespace syncer | 116 } // namespace syncer |
105 | 117 |
106 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ | 118 #endif // SYNC_SESSIONS_STATUS_CONTROLLER_H_ |
OLD | NEW |