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

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

Issue 1671933002: Create and pass shared-histogram-allocator from browser to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hsm-merge
Patch Set: rebased (use new PersistentHistogramAllocator) Created 4 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
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 <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/google/google_brand.h" 24 #include "chrome/browser/google/google_brand.h"
25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" 25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h"
26 #include "chrome/browser/metrics/metrics_reporting_state.h" 26 #include "chrome/browser/metrics/metrics_reporting_state.h"
27 #include "chrome/browser/metrics/subprocess_metrics_provider.h"
27 #include "chrome/browser/metrics/time_ticks_experiment_win.h" 28 #include "chrome/browser/metrics/time_ticks_experiment_win.h"
28 #include "chrome/browser/sync/chrome_sync_client.h" 29 #include "chrome/browser/sync/chrome_sync_client.h"
29 #include "chrome/browser/ui/browser_otr_state.h" 30 #include "chrome/browser/ui/browser_otr_state.h"
30 #include "chrome/common/channel_info.h" 31 #include "chrome/common/channel_info.h"
31 #include "chrome/common/chrome_constants.h" 32 #include "chrome/common/chrome_constants.h"
32 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/crash_keys.h" 35 #include "chrome/common/crash_keys.h"
35 #include "chrome/common/features.h" 36 #include "chrome/common/features.h"
36 #include "chrome/installer/util/util_constants.h" 37 #include "chrome/installer/util/util_constants.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // metrics service so that metrics log manager is initialized correctly. 351 // metrics service so that metrics log manager is initialized correctly.
351 if (ShouldClearSavedMetrics()) { 352 if (ShouldClearSavedMetrics()) {
352 PrefService* local_state = g_browser_process->local_state(); 353 PrefService* local_state = g_browser_process->local_state();
353 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs); 354 local_state->ClearPref(metrics::prefs::kMetricsInitialLogs);
354 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs); 355 local_state->ClearPref(metrics::prefs::kMetricsOngoingLogs);
355 } 356 }
356 357
357 metrics_service_.reset(new metrics::MetricsService( 358 metrics_service_.reset(new metrics::MetricsService(
358 metrics_state_manager_, this, g_browser_process->local_state())); 359 metrics_state_manager_, this, g_browser_process->local_state()));
359 360
361 // Gets access to persistent metrics shared by sub-processes.
362 metrics_service_->RegisterMetricsProvider(
363 scoped_ptr<metrics::MetricsProvider>(new SubprocessMetricsProvider()));
364
360 // Register metrics providers. 365 // Register metrics providers.
361 #if defined(ENABLE_EXTENSIONS) 366 #if defined(ENABLE_EXTENSIONS)
362 metrics_service_->RegisterMetricsProvider( 367 metrics_service_->RegisterMetricsProvider(
363 scoped_ptr<metrics::MetricsProvider>( 368 scoped_ptr<metrics::MetricsProvider>(
364 new ExtensionsMetricsProvider(metrics_state_manager_))); 369 new ExtensionsMetricsProvider(metrics_state_manager_)));
365 #endif 370 #endif
366 metrics_service_->RegisterMetricsProvider( 371 metrics_service_->RegisterMetricsProvider(
367 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider( 372 scoped_ptr<metrics::MetricsProvider>(new metrics::NetworkMetricsProvider(
368 content::BrowserThread::GetBlockingPool()))); 373 content::BrowserThread::GetBlockingPool())));
369 374
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 #if !defined(OS_CHROMEOS) 446 #if !defined(OS_CHROMEOS)
442 metrics_service_->RegisterMetricsProvider( 447 metrics_service_->RegisterMetricsProvider(
443 scoped_ptr<metrics::MetricsProvider>( 448 scoped_ptr<metrics::MetricsProvider>(
444 SigninStatusMetricsProvider::CreateInstance( 449 SigninStatusMetricsProvider::CreateInstance(
445 make_scoped_ptr(new ChromeSigninStatusMetricsProviderDelegate)))); 450 make_scoped_ptr(new ChromeSigninStatusMetricsProviderDelegate))));
446 #endif // !defined(OS_CHROMEOS) 451 #endif // !defined(OS_CHROMEOS)
447 452
448 metrics_service_->RegisterMetricsProvider( 453 metrics_service_->RegisterMetricsProvider(
449 scoped_ptr<metrics::MetricsProvider>( 454 scoped_ptr<metrics::MetricsProvider>(
450 new sync_driver::DeviceCountMetricsProvider(base::Bind( 455 new sync_driver::DeviceCountMetricsProvider(base::Bind(
451 &browser_sync::ChromeSyncClient::GetDeviceInfoTrackers)))); 456 &browser_sync::ChromeSyncClient::GetDeviceInfoTrackers))));
Alexei Svitkine (slow) 2016/03/29 17:51:24 In the future, please upload separate patchsets fo
bcwhite 2016/03/30 21:25:55 Acknowledged.
452 457
453 // Clear stability metrics if it is the first time cellular upload logic 458 // Clear stability metrics if it is the first time cellular upload logic
454 // should apply to avoid sudden bulk uploads. It needs to be done after all 459 // should apply to avoid sudden bulk uploads. It needs to be done after all
455 // providers are registered. 460 // providers are registered.
456 if (ShouldClearSavedMetrics()) 461 if (ShouldClearSavedMetrics())
457 metrics_service_->ClearSavedStabilityMetrics(); 462 metrics_service_->ClearSavedStabilityMetrics();
458 } 463 }
459 464
460 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() { 465 void ChromeMetricsServiceClient::OnInitTaskGotHardwareClass() {
461 const base::Closure got_bluetooth_adapter_callback = 466 const base::Closure got_bluetooth_adapter_callback =
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 break; 682 break;
678 683
679 default: 684 default:
680 NOTREACHED(); 685 NOTREACHED();
681 } 686 }
682 } 687 }
683 688
684 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { 689 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) {
685 metrics_service_->OnApplicationNotIdle(); 690 metrics_service_->OnApplicationNotIdle();
686 } 691 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698