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

Unified Diff: chrome/browser/metrics/variations/variations_service.h

Issue 12096096: Give access to a network time kept in the variation service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed CR comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/variations/variations_service.h
diff --git a/chrome/browser/metrics/variations/variations_service.h b/chrome/browser/metrics/variations/variations_service.h
index cd5bd36cd199912fb0d43d478409f9cfcbdb2cd2..7f067eaae89d226746cc9616e003f83f91a94509 100644
--- a/chrome/browser/metrics/variations/variations_service.h
+++ b/chrome/browser/metrics/variations/variations_service.h
@@ -47,6 +47,10 @@ class VariationsService
// |CreateTrialsFromSeed|.
void StartRepeatedVariationsSeedFetch();
+ // TODO(mad): Remove this once NetworkTimeService is extracted as stand alone.
+ bool GetNetworkTime(base::Time* network_time,
+ base::TimeDelta* uncertainty) const;
+
#if defined(OS_WIN)
// Starts syncing Google Update Variation IDs with the registry.
void StartGoogleUpdateRegistrySync();
@@ -183,6 +187,36 @@ class VariationsService
// latency of seed requests. Initially zero.
base::TimeTicks last_request_started_time_;
+ // TODO(mad): Eventually move this to a NetworkTimeService.
+ class NetworkTimeService {
Alexei Svitkine (slow) 2013/02/01 22:18:08 Put it in a separate file. "Service" is too ambiti
MAD 2013/02/04 21:07:43 Done.
+ public:
+ NetworkTimeService() {
Alexei Svitkine (slow) 2013/02/01 22:18:08 When this is a file, add a dtor and don't inline t
MAD 2013/02/04 21:07:43 Done.
+ };
+
+ // Returns a network time based on previous url request header value and CPU
+ // ticks count since then. Returns false if no network time is available
+ // yet. Can also return the error range if |uncertainty| isn't NULL.
+ bool GetNetworkTime(base::Time* network_time,
+ base::TimeDelta* uncertainty) const;
+ private:
+ // TODO(mad): Remove this once NetworkTimeService is extracted from here.
+ friend class VariationsService;
Alexei Svitkine (slow) 2013/02/01 22:18:08 Remove this and change the SetNetworkTime() call t
MAD 2013/02/04 21:07:43 Done.
+
+ void SetNetworkTime(const base::Time& network_time,
+ const base::TimeDelta& latency);
+
+ // Remember the network time based on last url request header value.
+ base::Time network_time_;
+
+ // The estimated ticks count when the date was set on the url request.
+ base::TimeTicks network_time_ticks_;
+
+ // Uncertainty of time based on added inaccuracies of the time is acquired.
+ base::TimeDelta network_time_uncertainty_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkTimeService);
+ } network_service_;
+
#if defined(OS_WIN)
// Helper that handles synchronizing Variations with the Registry.
VariationsRegistrySyncer registry_syncer_;

Powered by Google App Engine
This is Rietveld 408576698