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

Side by Side Diff: components/network_time/network_time_tracker.h

Issue 2415703005: Refine NetworkTimeTracker histograms (Closed)
Patch Set: Created 4 years, 2 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ 5 #ifndef COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_
6 #define COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ 6 #define COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Describes the result of a GetNetworkTime() call, describing whether 55 // Describes the result of a GetNetworkTime() call, describing whether
56 // network time was available and if not, why not. 56 // network time was available and if not, why not.
57 enum NetworkTimeResult { 57 enum NetworkTimeResult {
58 // Network time is available. 58 // Network time is available.
59 NETWORK_TIME_AVAILABLE, 59 NETWORK_TIME_AVAILABLE,
60 // A time has been retrieved from the network in the past, but 60 // A time has been retrieved from the network in the past, but
61 // network time is no longer available because the tracker fell out 61 // network time is no longer available because the tracker fell out
62 // of sync due to, for example, a suspend/resume. 62 // of sync due to, for example, a suspend/resume.
63 NETWORK_TIME_SYNC_LOST, 63 NETWORK_TIME_SYNC_LOST,
64 // Network time is unavailable because the tracker has not yet 64 // Network time is unavailable because the tracker has not yet
65 // retrieved a time from the network. 65 // attempted to retrieve a time from the network.
66 NETWORK_TIME_NO_SYNC, 66 NETWORK_TIME_NO_SYNC_ATTEMPT,
67 // Network time is unavailable because the tracker has not yet
68 // successfully retrieved a time from the network (at least one
69 // attempt has been made but all have failed).
70 NETWORK_TIME_NO_SUCCESSFUL_SYNC,
71 // Network time is unavailable because the tracker has not yet
72 // attempted to retrieve a time from the network, but the first
73 // attempt is currently pending.
74 NETWORK_TIME_FIRST_SYNC_PENDING,
75 // Network time is unavailable because the tracker has made failed
76 // attempts to retrieve a time from the network, but an attempt is
77 // currently pending.
78 NETWORK_TIME_SUBSEQUENT_SYNC_PENDING,
67 }; 79 };
68 80
69 static void RegisterPrefs(PrefRegistrySimple* registry); 81 static void RegisterPrefs(PrefRegistrySimple* registry);
70 82
71 // Constructor. Arguments may be stubbed out for tests. |getter|, if not 83 // Constructor. Arguments may be stubbed out for tests. |getter|, if not
72 // null, will cause automatic queries to a time server. Otherwise, time is 84 // null, will cause automatic queries to a time server. Otherwise, time is
73 // available only if |UpdateNetworkTime| is called. 85 // available only if |UpdateNetworkTime| is called.
74 NetworkTimeTracker(std::unique_ptr<base::Clock> clock, 86 NetworkTimeTracker(std::unique_ptr<base::Clock> clock,
75 std::unique_ptr<base::TickClock> tick_clock, 87 std::unique_ptr<base::TickClock> tick_clock,
76 PrefService* pref_service, 88 PrefService* pref_service,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // latency time. See UpdateNetworkTime(...) implementation for details. The 180 // latency time. See UpdateNetworkTime(...) implementation for details. The
169 // tick clock is the one actually used to return values to callers, but both 181 // tick clock is the one actually used to return values to callers, but both
170 // clocks must agree to within some tolerance. 182 // clocks must agree to within some tolerance.
171 base::Time time_at_last_measurement_; 183 base::Time time_at_last_measurement_;
172 base::TimeTicks ticks_at_last_measurement_; 184 base::TimeTicks ticks_at_last_measurement_;
173 185
174 // Uncertainty of |network_time_| based on added inaccuracies/resolution. See 186 // Uncertainty of |network_time_| based on added inaccuracies/resolution. See
175 // UpdateNetworkTime(...) implementation for details. 187 // UpdateNetworkTime(...) implementation for details.
176 base::TimeDelta network_time_uncertainty_; 188 base::TimeDelta network_time_uncertainty_;
177 189
190 // True if a time query has failed (either a network error, a non-200
mab 2016/10/14 06:35:01 like true if any time query has failed ever?
estark 2016/10/14 07:23:46 In this object's lifetime, yeah. It's just used to
191 // HTTP status code, or a bad response, such as a bad signature or
192 // malformed data).
193 bool time_query_failed_;
194
178 base::ThreadChecker thread_checker_; 195 base::ThreadChecker thread_checker_;
179 196
180 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker); 197 DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker);
181 }; 198 };
182 199
183 } // namespace network_time 200 } // namespace network_time
184 201
185 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_ 202 #endif // COMPONENTS_NETWORK_TIME_NETWORK_TIME_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | components/network_time/network_time_tracker.cc » ('j') | components/network_time/network_time_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698