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

Side by Side Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 2888563005: Added support for 'spare' file that can be used at startup. (Closed)
Patch Set: rebased Created 3 years, 7 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
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.cc ('k') | tools/metrics/histograms/enums.xml » ('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 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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Constructs the name of a persistent metrics file from a directory and metrics 174 // Constructs the name of a persistent metrics file from a directory and metrics
175 // name, and either registers that file as associated with a previous run if 175 // name, and either registers that file as associated with a previous run if
176 // metrics reporting is enabled, or deletes it if not. 176 // metrics reporting is enabled, or deletes it if not.
177 void RegisterOrRemovePreviousRunMetricsFile( 177 void RegisterOrRemovePreviousRunMetricsFile(
178 bool metrics_reporting_enabled, 178 bool metrics_reporting_enabled,
179 const base::FilePath& dir, 179 const base::FilePath& dir,
180 base::StringPiece metrics_name, 180 base::StringPiece metrics_name,
181 scoped_refptr<base::TaskRunner> task_runner, 181 scoped_refptr<base::TaskRunner> task_runner,
182 metrics::FileMetricsProvider* file_metrics_provider) { 182 metrics::FileMetricsProvider* file_metrics_provider) {
183 base::FilePath metrics_file; 183 base::FilePath metrics_file;
184 base::GlobalHistogramAllocator::ConstructFilePaths(dir, metrics_name, 184 base::GlobalHistogramAllocator::ConstructFilePaths(
185 &metrics_file, nullptr); 185 dir, metrics_name, &metrics_file, nullptr, nullptr);
186 186
187 if (metrics_reporting_enabled) { 187 if (metrics_reporting_enabled) {
188 // Enable reading any existing saved metrics. 188 // Enable reading any existing saved metrics.
189 file_metrics_provider->RegisterSource( 189 file_metrics_provider->RegisterSource(
190 metrics_file, 190 metrics_file,
191 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, 191 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE,
192 metrics::FileMetricsProvider::ASSOCIATE_PREVIOUS_RUN, metrics_name); 192 metrics::FileMetricsProvider::ASSOCIATE_PREVIOUS_RUN, metrics_name);
193 } else { 193 } else {
194 // When metrics reporting is not enabled, any existing file should be 194 // When metrics reporting is not enabled, any existing file should be
195 // deleted in order to preserve user privacy. 195 // deleted in order to preserve user privacy.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Register the Crashpad metrics files. 230 // Register the Crashpad metrics files.
231 // Register the data from the previous run if crashpad_handler didn't exit 231 // Register the data from the previous run if crashpad_handler didn't exit
232 // cleanly. 232 // cleanly.
233 RegisterOrRemovePreviousRunMetricsFile( 233 RegisterOrRemovePreviousRunMetricsFile(
234 metrics_reporting_enabled, user_data_dir, 234 metrics_reporting_enabled, user_data_dir,
235 kCrashpadHistogramAllocatorName, task_runner, 235 kCrashpadHistogramAllocatorName, task_runner,
236 file_metrics_provider.get()); 236 file_metrics_provider.get());
237 if (metrics_reporting_enabled) { 237 if (metrics_reporting_enabled) {
238 base::FilePath active_path; 238 base::FilePath active_path;
239 base::GlobalHistogramAllocator::ConstructFilePaths( 239 base::GlobalHistogramAllocator::ConstructFilePaths(
240 user_data_dir, kCrashpadHistogramAllocatorName, nullptr, 240 user_data_dir, kCrashpadHistogramAllocatorName, nullptr, &active_path,
241 &active_path); 241 nullptr);
242 // Register data that will be populated for the current run. "Active" 242 // Register data that will be populated for the current run. "Active"
243 // files need an empty "prefs_key" because they update the file itself. 243 // files need an empty "prefs_key" because they update the file itself.
244 file_metrics_provider->RegisterSource( 244 file_metrics_provider->RegisterSource(
245 active_path, 245 active_path,
246 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ACTIVE_FILE, 246 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ACTIVE_FILE,
247 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, 247 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN,
248 base::StringPiece()); 248 base::StringPiece());
249 } 249 }
250 } 250 }
251 251
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 ukm_service_->Purge(); 1002 ukm_service_->Purge();
1003 ukm_service_->ResetClientId(); 1003 ukm_service_->ResetClientId();
1004 } 1004 }
1005 // Signal service manager to enable/disable UKM based on new state. 1005 // Signal service manager to enable/disable UKM based on new state.
1006 UpdateRunningServices(); 1006 UpdateRunningServices();
1007 } 1007 }
1008 1008
1009 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() { 1009 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() {
1010 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles(); 1010 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles();
1011 } 1011 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.cc ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698