| 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/extensions/api/system_info_cpu/cpu_info_provider.h" | 5 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| 11 using api::system_info_cpu::CpuInfo; | 11 using api::system_info_cpu::CpuInfo; |
| 12 | 12 |
| 13 // Static member intialization. |
| 14 template<> |
| 15 base::LazyInstance<scoped_refptr<SystemInfoProvider<CpuInfo> > > |
| 16 SystemInfoProvider<CpuInfo>::provider_ = LAZY_INSTANCE_INITIALIZER; |
| 17 |
| 13 CpuInfoProvider::CpuInfoProvider() {} | 18 CpuInfoProvider::CpuInfoProvider() {} |
| 14 | 19 |
| 15 CpuInfoProvider::~CpuInfoProvider() {} | 20 CpuInfoProvider::~CpuInfoProvider() {} |
| 16 | 21 |
| 17 bool CpuInfoProvider::QueryInfo(CpuInfo* info) { | 22 const CpuInfo& CpuInfoProvider::cpu_info() const { |
| 18 if (info == NULL) | 23 return info_; |
| 19 return false; | 24 } |
| 20 | 25 |
| 21 info->num_of_processors = base::SysInfo::NumberOfProcessors(); | 26 bool CpuInfoProvider::QueryInfo() { |
| 22 info->arch_name = base::SysInfo::OperatingSystemArchitecture(); | 27 info_.num_of_processors = base::SysInfo::NumberOfProcessors(); |
| 23 info->model_name = base::SysInfo::CPUModelName(); | 28 info_.arch_name = base::SysInfo::OperatingSystemArchitecture(); |
| 29 info_.model_name = base::SysInfo::CPUModelName(); |
| 24 return true; | 30 return true; |
| 25 } | 31 } |
| 26 | 32 |
| 27 // static | 33 // static |
| 28 CpuInfoProvider* CpuInfoProvider::Get() { | 34 CpuInfoProvider* CpuInfoProvider::Get() { |
| 29 return CpuInfoProvider::GetInstance<CpuInfoProvider>(); | 35 return CpuInfoProvider::GetInstance<CpuInfoProvider>(); |
| 30 } | 36 } |
| 31 | 37 |
| 32 } // namespace extensions | 38 } // namespace extensions |
| OLD | NEW |