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

Side by Side Diff: base/sys_info_ios.mm

Issue 10914060: Refine systemInfo.cpu API defintions and provide systemInfo.cpu.get impl for Windows and Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use empty string instead unknown Created 8 years, 3 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
OLDNEW
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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 #include <sys/sysctl.h>
10 #include <sys/types.h>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/mac/scoped_nsautorelease_pool.h" 13 #include "base/mac/scoped_nsautorelease_pool.h"
12 #include "base/sys_string_conversions.h" 14 #include "base/sys_string_conversions.h"
13 15
14 namespace base { 16 namespace base {
15 17
16 // static 18 // static
17 std::string SysInfo::OperatingSystemName() { 19 std::string SysInfo::OperatingSystemName() {
18 base::mac::ScopedNSAutoreleasePool pool; 20 base::mac::ScopedNSAutoreleasePool pool;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 reinterpret_cast<host_info_t>(&hostinfo), 60 reinterpret_cast<host_info_t>(&hostinfo),
59 &count); 61 &count);
60 if (result != KERN_SUCCESS) { 62 if (result != KERN_SUCCESS) {
61 NOTREACHED(); 63 NOTREACHED();
62 return 0; 64 return 0;
63 } 65 }
64 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); 66 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count);
65 return static_cast<int64>(hostinfo.max_mem); 67 return static_cast<int64>(hostinfo.max_mem);
66 } 68 }
67 69
70 // static
71 std::string SysInfo::CPUModelName() {
72 char name[256];
73 size_t len = arraysize(name);
74 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0)
75 return name;
76 return "";
Mark Mentovai 2012/09/06 14:45:18 Rather than an implicit conversion, use std::strin
Hongbo Min 2012/09/06 14:55:16 Done.
77 }
78
68 } // namespace base 79 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698