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

Side by Side Diff: base/sys_info_linux.cc

Issue 14872004: Fixed CPU info reporting on ChromeOS ARM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698