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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.h

Issue 333313003: Simulate variation seeds using installed version string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/metrics/variations/variations_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
13 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "chrome/browser/metrics/variations/variations_request_scheduler.h" 16 #include "chrome/browser/metrics/variations/variations_request_scheduler.h"
16 #include "chrome/browser/metrics/variations/variations_seed_store.h" 17 #include "chrome/browser/metrics/variations/variations_seed_store.h"
17 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h" 18 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h"
18 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
19 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h" 24 #include "chrome/browser/metrics/variations/variations_registry_syncer_win.h"
24 #endif 25 #endif
25 26
26 class PrefService; 27 class PrefService;
27 class PrefRegistrySimple; 28 class PrefRegistrySimple;
28 29
29 namespace user_prefs { 30 namespace base {
30 class PrefRegistrySyncable; 31 class Version;
31 } 32 }
32 33
33 namespace metrics { 34 namespace metrics {
34 class MetricsStateManager; 35 class MetricsStateManager;
35 } 36 }
36 37
38 namespace user_prefs {
39 class PrefRegistrySyncable;
40 }
41
37 namespace chrome_variations { 42 namespace chrome_variations {
38 43
39 class VariationsSeed; 44 class VariationsSeed;
40 45
41 // Used to setup field trials based on stored variations seed data, and fetch 46 // Used to setup field trials based on stored variations seed data, and fetch
42 // new seed data from the variations server. 47 // new seed data from the variations server.
43 class VariationsService 48 class VariationsService
44 : public net::URLFetcherDelegate, 49 : public net::URLFetcherDelegate,
45 public ResourceRequestAllowedNotifier::Observer { 50 public ResourceRequestAllowedNotifier::Observer {
46 public: 51 public:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Checks if prerequisites for fetching the Variations seed are met, and if 143 // Checks if prerequisites for fetching the Variations seed are met, and if
139 // so, performs the actual fetch using |DoActualFetch|. 144 // so, performs the actual fetch using |DoActualFetch|.
140 void FetchVariationsSeed(); 145 void FetchVariationsSeed();
141 146
142 // net::URLFetcherDelegate implementation: 147 // net::URLFetcherDelegate implementation:
143 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 148 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
144 149
145 // ResourceRequestAllowedNotifier::Observer implementation: 150 // ResourceRequestAllowedNotifier::Observer implementation:
146 virtual void OnResourceRequestsAllowed() OVERRIDE; 151 virtual void OnResourceRequestsAllowed() OVERRIDE;
147 152
153 // Performs a variations seed simulation with the given |seed| and |version|
154 // and logs the simulation results as histograms.
155 void PerformSimulationWithVersion(scoped_ptr<VariationsSeed> seed,
156 const base::Version& version);
157
148 // Record the time of the most recent successful fetch. 158 // Record the time of the most recent successful fetch.
149 void RecordLastFetchTime(); 159 void RecordLastFetchTime();
150 160
151 // The pref service used to store persist the variations seed. 161 // The pref service used to store persist the variations seed.
152 PrefService* local_state_; 162 PrefService* local_state_;
153 163
154 // Used for instantiating entropy providers for variations seed simulation. 164 // Used for instantiating entropy providers for variations seed simulation.
155 // Weak pointer. 165 // Weak pointer.
156 metrics::MetricsStateManager* state_manager_; 166 metrics::MetricsStateManager* state_manager_;
157 167
(...skipping 28 matching lines...) Expand all
186 196
187 // The start time of the last seed request. This is used to measure the 197 // The start time of the last seed request. This is used to measure the
188 // latency of seed requests. Initially zero. 198 // latency of seed requests. Initially zero.
189 base::TimeTicks last_request_started_time_; 199 base::TimeTicks last_request_started_time_;
190 200
191 #if defined(OS_WIN) 201 #if defined(OS_WIN)
192 // Helper that handles synchronizing Variations with the Registry. 202 // Helper that handles synchronizing Variations with the Registry.
193 VariationsRegistrySyncer registry_syncer_; 203 VariationsRegistrySyncer registry_syncer_;
194 #endif 204 #endif
195 205
206 base::WeakPtrFactory<VariationsService> weak_ptr_factory_;
207
196 DISALLOW_COPY_AND_ASSIGN(VariationsService); 208 DISALLOW_COPY_AND_ASSIGN(VariationsService);
197 }; 209 };
198 210
199 } // namespace chrome_variations 211 } // namespace chrome_variations
200 212
201 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_ 213 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/variations/variations_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698