Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "components/metrics/metrics_log.h" | 5 #include "components/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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 // Reduce granularity of the enabled_date field to nearest hour. | 344 // Reduce granularity of the enabled_date field to nearest hour. |
| 345 system_profile->set_uma_enabled_date(RoundSecondsToHour(enabled_date)); | 345 system_profile->set_uma_enabled_date(RoundSecondsToHour(enabled_date)); |
| 346 | 346 |
| 347 // Reduce granularity of the install_date field to nearest hour. | 347 // Reduce granularity of the install_date field to nearest hour. |
| 348 system_profile->set_install_date(RoundSecondsToHour(install_date)); | 348 system_profile->set_install_date(RoundSecondsToHour(install_date)); |
| 349 | 349 |
| 350 system_profile->set_application_locale(client_->GetApplicationLocale()); | 350 system_profile->set_application_locale(client_->GetApplicationLocale()); |
| 351 | 351 |
| 352 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 352 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
| 353 | 353 |
| 354 #if defined(OS_MACOSX) | |
| 355 hardware->set_hardware_class(base::SysInfo::HardwareModelName()); | |
| 356 #else | |
| 354 // By default, the hardware class is empty (i.e., unknown). | 357 // By default, the hardware class is empty (i.e., unknown). |
| 355 hardware->set_hardware_class(std::string()); | 358 hardware->set_hardware_class(std::string()); |
| 359 #endif | |
|
Alexei Svitkine (slow)
2014/11/04 16:22:12
FWIW, I'd prefer if we can avoid ifdefs in this co
jeremy
2014/11/05 05:38:06
Done.
| |
| 356 | 360 |
| 357 hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); | 361 hardware->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); |
| 358 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); | 362 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); |
| 359 #if defined(OS_WIN) | 363 #if defined(OS_WIN) |
| 360 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); | 364 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); |
| 361 #endif | 365 #endif |
| 362 | 366 |
| 363 SystemProfileProto::OS* os = system_profile->mutable_os(); | 367 SystemProfileProto::OS* os = system_profile->mutable_os(); |
| 364 std::string os_name = base::SysInfo::OperatingSystemName(); | 368 std::string os_name = base::SysInfo::OperatingSystemName(); |
| 365 #if defined(OS_WIN) | 369 #if defined(OS_WIN) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 DCHECK(!closed_); | 430 DCHECK(!closed_); |
| 427 closed_ = true; | 431 closed_ = true; |
| 428 } | 432 } |
| 429 | 433 |
| 430 void MetricsLog::GetEncodedLog(std::string* encoded_log) { | 434 void MetricsLog::GetEncodedLog(std::string* encoded_log) { |
| 431 DCHECK(closed_); | 435 DCHECK(closed_); |
| 432 uma_proto_.SerializeToString(encoded_log); | 436 uma_proto_.SerializeToString(encoded_log); |
| 433 } | 437 } |
| 434 | 438 |
| 435 } // namespace metrics | 439 } // namespace metrics |
| OLD | NEW |