OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/sys_info.h" | 5 #include "base/sys_info.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } else { | 54 } else { |
55 NOTREACHED(); | 55 NOTREACHED(); |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 } | 58 } |
59 return static_cast<size_t>(limit); | 59 return static_cast<size_t>(limit); |
60 } | 60 } |
61 | 61 |
62 // static | 62 // static |
63 std::string SysInfo::CPUModelName() { | 63 std::string SysInfo::CPUModelName() { |
64 const char kModelNamePrefix[] = "model name"; | 64 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 65 const char kCpuModelPrefix[] = "Hardware"; |
| 66 #else |
| 67 const char kCpuModelPrefix[] = "model name"; |
| 68 #endif |
65 std::string contents; | 69 std::string contents; |
66 file_util::ReadFileToString(FilePath("/proc/cpuinfo"), &contents); | 70 file_util::ReadFileToString(FilePath("/proc/cpuinfo"), &contents); |
67 DCHECK(!contents.empty()); | 71 DCHECK(!contents.empty()); |
68 if (!contents.empty()) { | 72 if (!contents.empty()) { |
69 std::istringstream iss(contents); | 73 std::istringstream iss(contents); |
70 std::string line; | 74 std::string line; |
71 while (std::getline(iss, line)){ | 75 while (std::getline(iss, line)) { |
72 if (line.compare(0, strlen(kModelNamePrefix), kModelNamePrefix) == 0) { | 76 if (line.compare(0, strlen(kCpuModelPrefix), kCpuModelPrefix) == 0) { |
73 size_t pos = line.find(": "); | 77 size_t pos = line.find(": "); |
74 return line.substr(pos + 2); | 78 return line.substr(pos + 2); |
75 } | 79 } |
76 } | 80 } |
77 } | 81 } |
78 return std::string(); | 82 return std::string(); |
79 } | 83 } |
80 | 84 |
81 } // namespace base | 85 } // namespace base |
OLD | NEW |