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

Side by Side Diff: components/metrics/file_metrics_provider.h

Issue 2524363003: Support experiment configurations with/without stability metrics. (Closed)
Patch Set: Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_METRICS_FILE_METRICS_PROVIDER_H_ 5 #ifndef COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ 6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 SourceType type, 94 SourceType type,
95 SourceAssociation source_association, 95 SourceAssociation source_association,
96 const base::StringPiece prefs_key); 96 const base::StringPiece prefs_key);
97 97
98 // Registers all necessary preferences for maintaining persistent state 98 // Registers all necessary preferences for maintaining persistent state
99 // about a monitored file across process restarts. The |prefs_key| is 99 // about a monitored file across process restarts. The |prefs_key| is
100 // typically the filename. 100 // typically the filename.
101 static void RegisterPrefs(PrefRegistrySimple* prefs, 101 static void RegisterPrefs(PrefRegistrySimple* prefs,
102 const base::StringPiece prefs_key); 102 const base::StringPiece prefs_key);
103 103
104 // Allow stability metrics support (those found in a file for a previous run
105 // of the browser) to be enabled/disabled. By default it is enabled.
106 static void SetStabilityMetricsEnabled(bool enabled) {
107 stability_metrics_enabled_ = enabled;
Alexei Svitkine (slow) 2016/11/24 21:27:58 Nit: Either use hacker_style for the function name
bcwhite 2016/11/25 18:51:58 Done.
108 }
109
104 private: 110 private:
105 friend class FileMetricsProviderTest; 111 friend class FileMetricsProviderTest;
106 112
107 // The different results that can occur accessing a file. 113 // The different results that can occur accessing a file.
108 enum AccessResult { 114 enum AccessResult {
109 // File was successfully mapped. 115 // File was successfully mapped.
110 ACCESS_RESULT_SUCCESS, 116 ACCESS_RESULT_SUCCESS,
111 117
112 // File does not exist. 118 // File does not exist.
113 ACCESS_RESULT_DOESNT_EXIST, 119 ACCESS_RESULT_DOESNT_EXIST,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // they are not subject to the periodic background checking that handles 195 // they are not subject to the periodic background checking that handles
190 // metrics for the current run. 196 // metrics for the current run.
191 SourceInfoList sources_for_previous_run_; 197 SourceInfoList sources_for_previous_run_;
192 198
193 // The preferences-service used to store persistent state about sources. 199 // The preferences-service used to store persistent state about sources.
194 PrefService* pref_service_; 200 PrefService* pref_service_;
195 201
196 base::ThreadChecker thread_checker_; 202 base::ThreadChecker thread_checker_;
197 base::WeakPtrFactory<FileMetricsProvider> weak_factory_; 203 base::WeakPtrFactory<FileMetricsProvider> weak_factory_;
198 204
205 // Flag indicating if stability metrics are enabled or disabled.
206 static bool stability_metrics_enabled_;
207
199 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider); 208 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider);
200 }; 209 };
201 210
202 } // namespace metrics 211 } // namespace metrics
203 212
204 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ 213 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698