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

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 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
65 const char kHardwarePrefix[] = "Hardware";
66 #else
64 const char kModelNamePrefix[] = "model name"; 67 const char kModelNamePrefix[] = "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)) {
76 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
darin (slow to review) 2013/05/03 06:07:09 nit: #ifdefs suck. i'd be tempted to generalize t
zel 2013/05/03 18:02:16 Down to one #ifdef now. Even if I split this in a
77 if (line.compare(0, strlen(kHardwarePrefix), kHardwarePrefix) == 0) {
78 #else
72 if (line.compare(0, strlen(kModelNamePrefix), kModelNamePrefix) == 0) { 79 if (line.compare(0, strlen(kModelNamePrefix), kModelNamePrefix) == 0) {
80 #endif
73 size_t pos = line.find(": "); 81 size_t pos = line.find(": ");
74 return line.substr(pos + 2); 82 return line.substr(pos + 2);
75 } 83 }
76 } 84 }
77 } 85 }
78 return std::string(); 86 return std::string();
79 } 87 }
80 88
81 } // namespace base 89 } // 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