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

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

Issue 2782903002: Disable sending persistent histograms from last session by default. (Closed)
Patch Set: Fix includes and use base/ param API. Created 3 years, 8 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 | « no previous file | components/metrics/file_metrics_provider.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 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/lazy_instance.h" 18 #include "base/lazy_instance.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/metrics/field_trial_params.h"
21 #include "base/metrics/histogram_macros.h" 22 #include "base/metrics/histogram_macros.h"
22 #include "base/metrics/persistent_histogram_allocator.h" 23 #include "base/metrics/persistent_histogram_allocator.h"
23 #include "base/metrics/statistics_recorder.h" 24 #include "base/metrics/statistics_recorder.h"
24 #include "base/path_service.h" 25 #include "base/path_service.h"
25 #include "base/rand_util.h" 26 #include "base/rand_util.h"
26 #include "base/strings/string16.h" 27 #include "base/strings/string16.h"
27 #include "base/threading/platform_thread.h" 28 #include "base/threading/platform_thread.h"
28 #include "base/threading/sequenced_worker_pool.h" 29 #include "base/threading/sequenced_worker_pool.h"
29 #include "base/threading/thread_task_runner_handle.h" 30 #include "base/threading/thread_task_runner_handle.h"
30 #include "build/build_config.h" 31 #include "build/build_config.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ->GetTaskRunnerWithShutdownBehavior( 204 ->GetTaskRunnerWithShutdownBehavior(
204 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 205 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
205 206
206 // Create an object to monitor files of metrics and include them in reports. 207 // Create an object to monitor files of metrics and include them in reports.
207 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( 208 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider(
208 new metrics::FileMetricsProvider(task_runner, 209 new metrics::FileMetricsProvider(task_runner,
209 g_browser_process->local_state())); 210 g_browser_process->local_state()));
210 211
211 base::FilePath user_data_dir; 212 base::FilePath user_data_dir;
212 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { 213 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
213 // Register the file holding browser metrics. 214 // Reporting of persistent histograms from last session is controlled by
215 // a feature param. TODO(bcwhite): The current default is not to upload
216 // until some issues are resolved. See crbug.com/706422 for details.
217 std::string send_unreported = base::GetFieldTrialParamValueByFeature(
218 base::kPersistentHistogramsFeature, "send_unreported_metrics");
219 bool report_previous_persistent_histograms =
220 metrics_reporting_enabled && (send_unreported == "yes");
214 RegisterOrRemovePreviousRunMetricsFile( 221 RegisterOrRemovePreviousRunMetricsFile(
215 metrics_reporting_enabled, user_data_dir, 222 report_previous_persistent_histograms, user_data_dir,
216 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner, 223 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner,
217 file_metrics_provider.get()); 224 file_metrics_provider.get());
218 225
219 // Register the Crashpad metrics files. 226 // Register the Crashpad metrics files.
220 // Register the data from the previous run if crashpad_handler didn't exit 227 // Register the data from the previous run if crashpad_handler didn't exit
221 // cleanly. 228 // cleanly.
222 RegisterOrRemovePreviousRunMetricsFile( 229 RegisterOrRemovePreviousRunMetricsFile(
223 metrics_reporting_enabled, user_data_dir, 230 metrics_reporting_enabled, user_data_dir,
224 kCrashpadHistogramAllocatorName, task_runner, 231 kCrashpadHistogramAllocatorName, task_runner,
225 file_metrics_provider.get()); 232 file_metrics_provider.get());
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 ukm_service_->Purge(); 974 ukm_service_->Purge();
968 ukm_service_->ResetClientId(); 975 ukm_service_->ResetClientId();
969 } 976 }
970 // Signal service manager to enable/disable UKM based on new state. 977 // Signal service manager to enable/disable UKM based on new state.
971 UpdateRunningServices(); 978 UpdateRunningServices();
972 } 979 }
973 980
974 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() { 981 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() {
975 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles(); 982 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles();
976 } 983 }
OLDNEW
« no previous file with comments | « no previous file | components/metrics/file_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698