Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: components/sync/sessions_impl/status_controller.h

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // StatusController handles all counter and status related number crunching and
6 // state tracking on behalf of a SyncSession.
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_SESSIONS_IMPL_STATUS_CONTROLLER_H_
18 #define COMPONENTS_SYNC_SESSIONS_IMPL_STATUS_CONTROLLER_H_
19
20 #include <map>
21 #include <vector>
22
23 #include "base/logging.h"
24 #include "base/macros.h"
25 #include "base/stl_util.h"
26 #include "base/time/time.h"
27 #include "components/sync/engine/model_safe_worker.h"
28 #include "components/sync/sessions/model_neutral_state.h"
29
30 namespace syncer {
31 namespace sessions {
32
33 class StatusController {
34 public:
35 StatusController();
36 ~StatusController();
37
38 // The types included in the get updates and commit client to server requests.
39 const ModelTypeSet get_updates_request_types() const;
40 void set_get_updates_request_types(ModelTypeSet value);
41 const ModelTypeSet commit_request_types() const;
42 void set_commit_request_types(ModelTypeSet value);
43
44 // Various conflict counters.
45 int num_encryption_conflicts() const;
46 int num_hierarchy_conflicts() const;
47 int num_server_conflicts() const;
48
49 // Aggregate sum of all conflicting items over all conflict types.
50 int TotalNumConflictingItems() const;
51
52 // Number of successfully applied updates.
53 int num_updates_applied() const;
54
55 int num_server_overwrites() const;
56 int num_local_overwrites() const;
57
58 // The time at which we started the first sync cycle in this session.
59 base::Time sync_start_time() const { return sync_start_time_; }
60
61 // If a poll was performed in this session, the time at which it finished.
62 // Not set if no poll was performed.
63 base::Time poll_finish_time() const { return poll_finish_time_; }
64
65 const ModelNeutralState& model_neutral_state() const {
66 return model_neutral_;
67 }
68
69 SyncerError last_get_key_result() const;
70
71 // Download counters.
72 void increment_num_updates_downloaded_by(int value);
73 void increment_num_tombstone_updates_downloaded_by(int value);
74 void increment_num_reflected_updates_downloaded_by(int value);
75
76 // Update application and conflict resolution counters.
77 void increment_num_updates_applied_by(int value);
78 void increment_num_encryption_conflicts_by(int value);
79 void increment_num_hierarchy_conflicts_by(int value);
80 void increment_num_server_conflicts();
81 void increment_num_local_overwrites();
82 void increment_num_server_overwrites();
83
84 // Commit counters.
85 void increment_num_successful_commits();
86 void increment_num_successful_bookmark_commits();
87 void set_num_successful_bookmark_commits(int value);
88
89 // Server communication status tracking.
90 void set_last_get_key_result(const SyncerError result);
91 void set_last_download_updates_result(const SyncerError result);
92 void set_commit_result(const SyncerError result);
93
94 void UpdateStartTime();
95 void UpdatePollTime();
96
97 private:
98 ModelNeutralState model_neutral_;
99
100 // Time the last sync cycle began.
101 base::Time sync_start_time_;
102
103 // If a poll was performed, the time it finished. Not set if not poll was
104 // performed.
105 base::Time poll_finish_time_;
106
107 DISALLOW_COPY_AND_ASSIGN(StatusController);
108 };
109
110 } // namespace sessions
111 } // namespace syncer
112
113 #endif // COMPONENTS_SYNC_SESSIONS_IMPL_STATUS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « components/sync/sessions_impl/nudge_tracker_unittest.cc ('k') | components/sync/sessions_impl/status_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698