Chromium Code Reviews| 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_; |