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

Side by Side Diff: extensions/browser/api/system_cpu/cpu_info_provider.cc

Issue 1842953002: [Extensions] Convert APIs to use movable types [13] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/browser/api/system_cpu/cpu_info_provider.h" 5 #include "extensions/browser/api/system_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
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 bool CpuInfoProvider::QueryInfo() { 29 bool CpuInfoProvider::QueryInfo() {
30 info_.num_of_processors = base::SysInfo::NumberOfProcessors(); 30 info_.num_of_processors = base::SysInfo::NumberOfProcessors();
31 info_.arch_name = base::SysInfo::OperatingSystemArchitecture(); 31 info_.arch_name = base::SysInfo::OperatingSystemArchitecture();
32 info_.model_name = base::SysInfo::CPUModelName(); 32 info_.model_name = base::SysInfo::CPUModelName();
33 info_.features = GetFeatures(); 33 info_.features = GetFeatures();
34 34
35 info_.processors.clear(); 35 info_.processors.clear();
36 // Fill in the correct number of uninitialized ProcessorInfos. 36 // Fill in the correct number of uninitialized ProcessorInfos.
37 for (int i = 0; i < info_.num_of_processors; ++i) { 37 for (int i = 0; i < info_.num_of_processors; ++i)
38 info_.processors.push_back(linked_ptr<api::system_cpu::ProcessorInfo>( 38 info_.processors.push_back(api::system_cpu::ProcessorInfo());
39 new api::system_cpu::ProcessorInfo()));
40 }
41 // Initialize the ProcessorInfos, or return an empty array if that fails. 39 // Initialize the ProcessorInfos, or return an empty array if that fails.
42 if (!QueryCpuTimePerProcessor(&info_.processors)) 40 if (!QueryCpuTimePerProcessor(&info_.processors))
43 info_.processors.clear(); 41 info_.processors.clear();
44 return true; 42 return true;
45 } 43 }
46 44
47 std::vector<std::string> CpuInfoProvider::GetFeatures() const { 45 std::vector<std::string> CpuInfoProvider::GetFeatures() const {
48 std::vector<std::string> features; 46 std::vector<std::string> features;
49 // These are the feature codes used by /proc/cpuinfo on Linux. 47 // These are the feature codes used by /proc/cpuinfo on Linux.
50 if (cpu_.has_mmx()) 48 if (cpu_.has_mmx())
(...skipping 16 matching lines...) Expand all
67 } 65 }
68 66
69 // static 67 // static
70 CpuInfoProvider* CpuInfoProvider::Get() { 68 CpuInfoProvider* CpuInfoProvider::Get() {
71 if (provider_.Get().get() == NULL) 69 if (provider_.Get().get() == NULL)
72 provider_.Get() = new CpuInfoProvider(); 70 provider_.Get() = new CpuInfoProvider();
73 return provider_.Get().get(); 71 return provider_.Get().get();
74 } 72 }
75 73
76 } // namespace extensions 74 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_cpu/cpu_info_provider.h ('k') | extensions/browser/api/system_cpu/cpu_info_provider_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698