Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
| 9 #include <mach/mach_host.h> | 9 #include <mach/mach_host.h> |
| 10 #include <mach/mach_init.h> | 10 #include <mach/mach_init.h> |
| 11 #include <sys/sysctl.h> | |
| 12 #include <sys/types.h> | |
| 11 | 13 |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 | 18 |
| 17 // static | 19 // static |
| 18 std::string SysInfo::OperatingSystemName() { | 20 std::string SysInfo::OperatingSystemName() { |
| 19 return "Mac OS X"; | 21 return "Mac OS X"; |
| 20 } | 22 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 47 reinterpret_cast<host_info_t>(&hostinfo), | 49 reinterpret_cast<host_info_t>(&hostinfo), |
| 48 &count); | 50 &count); |
| 49 if (result != KERN_SUCCESS) { | 51 if (result != KERN_SUCCESS) { |
| 50 NOTREACHED(); | 52 NOTREACHED(); |
| 51 return 0; | 53 return 0; |
| 52 } | 54 } |
| 53 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); | 55 DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); |
| 54 return static_cast<int64>(hostinfo.max_mem); | 56 return static_cast<int64>(hostinfo.max_mem); |
| 55 } | 57 } |
| 56 | 58 |
| 59 // static | |
| 60 std::string SysInfo::CPUModelName() { | |
| 61 char name[256]; | |
| 62 size_t len = arraysize(name); | |
| 63 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) | |
| 64 return name; | |
| 65 return ""; | |
|
Mark Mentovai
2012/09/06 14:45:18
Same.
Hongbo Min
2012/09/06 14:55:16
Done.
| |
| 66 } | |
| 67 | |
| 57 } // namespace base | 68 } // namespace base |
| OLD | NEW |