Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 #include "base/android/build_info.h" | 55 #include "base/android/build_info.h" |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 #include "base/win/metro.h" | 59 #include "base/win/metro.h" |
| 60 | 60 |
| 61 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 61 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| 62 extern "C" IMAGE_DOS_HEADER __ImageBase; | 62 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if defined(OS_CHROMEOS) | |
| 66 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 67 #endif | |
| 68 | |
| 65 using content::GpuDataManager; | 69 using content::GpuDataManager; |
| 66 using metrics::OmniboxEventProto; | 70 using metrics::OmniboxEventProto; |
| 67 using metrics::PerfDataProto; | 71 using metrics::PerfDataProto; |
| 68 using metrics::ProfilerEventProto; | 72 using metrics::ProfilerEventProto; |
| 69 using metrics::SystemProfileProto; | 73 using metrics::SystemProfileProto; |
| 70 using tracked_objects::ProcessDataSnapshot; | 74 using tracked_objects::ProcessDataSnapshot; |
| 71 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 75 typedef chrome_variations::ActiveGroupId ActiveGroupId; |
| 72 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 76 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
| 73 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; | 77 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; |
| 74 | 78 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 } // namespace | 376 } // namespace |
| 373 | 377 |
| 374 GoogleUpdateMetrics::GoogleUpdateMetrics() : is_system_install(false) {} | 378 GoogleUpdateMetrics::GoogleUpdateMetrics() : is_system_install(false) {} |
| 375 | 379 |
| 376 GoogleUpdateMetrics::~GoogleUpdateMetrics() {} | 380 GoogleUpdateMetrics::~GoogleUpdateMetrics() {} |
| 377 | 381 |
| 378 static base::LazyInstance<std::string>::Leaky | 382 static base::LazyInstance<std::string>::Leaky |
| 379 g_version_extension = LAZY_INSTANCE_INITIALIZER; | 383 g_version_extension = LAZY_INSTANCE_INITIALIZER; |
| 380 | 384 |
| 381 MetricsLog::MetricsLog(const std::string& client_id, int session_id) | 385 MetricsLog::MetricsLog(const std::string& client_id, int session_id) |
| 382 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} | 386 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) { |
| 387 #if defined(OS_CHROMEOS) | |
| 388 initial_multi_profile_user_count_ = 0; | |
|
Ilya Sherman
2013/09/30 23:42:52
nit: Please move this to the initializer list.
| |
| 389 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | |
| 390 if (user_manager && user_manager->IsMultipleProfilesAllowed()) | |
| 391 initial_multi_profile_user_count_ = user_manager->GetLoggedInUsers().size(); | |
| 392 #endif | |
| 393 } | |
| 383 | 394 |
| 384 MetricsLog::~MetricsLog() {} | 395 MetricsLog::~MetricsLog() {} |
| 385 | 396 |
| 386 // static | 397 // static |
| 387 void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) { | 398 void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) { |
| 388 registry->RegisterListPref(prefs::kStabilityPluginStats); | 399 registry->RegisterListPref(prefs::kStabilityPluginStats); |
| 389 } | 400 } |
| 390 | 401 |
| 391 // static | 402 // static |
| 392 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { | 403 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 if (perf_provider_.GetPerfData(&perf_data_proto)) | 803 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 793 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 804 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 794 | 805 |
| 795 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that | 806 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that |
| 796 // changes this will fail at the DCHECK(). | 807 // changes this will fail at the DCHECK(). |
| 797 device::BluetoothAdapterFactory::GetAdapter( | 808 device::BluetoothAdapterFactory::GetAdapter( |
| 798 base::Bind(&MetricsLog::SetBluetoothAdapter, | 809 base::Bind(&MetricsLog::SetBluetoothAdapter, |
| 799 base::Unretained(this))); | 810 base::Unretained(this))); |
| 800 DCHECK(adapter_.get()); | 811 DCHECK(adapter_.get()); |
| 801 WriteBluetoothProto(hardware); | 812 WriteBluetoothProto(hardware); |
| 813 | |
| 814 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | |
| 815 if (user_manager && user_manager->IsMultipleProfilesAllowed()) { | |
| 816 int user_count = user_manager->GetLoggedInUsers().size(); | |
| 817 // We invalidate the user count if it changed while the log was open. | |
| 818 if (user_count != initial_multi_profile_user_count_) | |
| 819 user_count = 0; | |
| 820 system_profile->set_multi_profile_user_count(user_count); | |
| 821 } | |
| 802 #endif | 822 #endif |
| 803 } | 823 } |
| 804 | 824 |
| 805 void MetricsLog::RecordProfilerData( | 825 void MetricsLog::RecordProfilerData( |
| 806 const tracked_objects::ProcessDataSnapshot& process_data, | 826 const tracked_objects::ProcessDataSnapshot& process_data, |
| 807 int process_type) { | 827 int process_type) { |
| 808 DCHECK(!locked()); | 828 DCHECK(!locked()); |
| 809 | 829 |
| 810 if (tracked_objects::GetTimeSourceType() != | 830 if (tracked_objects::GetTimeSourceType() != |
| 811 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { | 831 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 | 967 |
| 948 paired_device->set_vendor_prefix(vendor_prefix); | 968 paired_device->set_vendor_prefix(vendor_prefix); |
| 949 } | 969 } |
| 950 | 970 |
| 951 paired_device->set_vendor_id(device->GetVendorID()); | 971 paired_device->set_vendor_id(device->GetVendorID()); |
| 952 paired_device->set_product_id(device->GetProductID()); | 972 paired_device->set_product_id(device->GetProductID()); |
| 953 paired_device->set_device_id(device->GetDeviceID()); | 973 paired_device->set_device_id(device->GetDeviceID()); |
| 954 } | 974 } |
| 955 #endif // defined(OS_CHROMEOS) | 975 #endif // defined(OS_CHROMEOS) |
| 956 } | 976 } |
| OLD | NEW |