| 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 <mach/mach.h> | 7 #include <mach/mach.h> | 
| 8 #include <sys/sysctl.h> | 8 #include <sys/sysctl.h> | 
| 9 #include <sys/types.h> | 9 #include <sys/types.h> | 
| 10 #import <UIKit/UIKit.h> | 10 #import <UIKit/UIKit.h> | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59     if (num_read < 3) | 59     if (num_read < 3) | 
| 60       *bugfix_version = 0; | 60       *bugfix_version = 0; | 
| 61   } | 61   } | 
| 62 } | 62 } | 
| 63 | 63 | 
| 64 // static | 64 // static | 
| 65 int64 SysInfo::AmountOfPhysicalMemory() { | 65 int64 SysInfo::AmountOfPhysicalMemory() { | 
| 66   struct host_basic_info hostinfo; | 66   struct host_basic_info hostinfo; | 
| 67   mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; | 67   mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; | 
| 68   base::mac::ScopedMachSendRight host(mach_host_self()); | 68   base::mac::ScopedMachSendRight host(mach_host_self()); | 
| 69   int result = host_info(host, | 69   int result = host_info(host.get(), | 
| 70                          HOST_BASIC_INFO, | 70                          HOST_BASIC_INFO, | 
| 71                          reinterpret_cast<host_info_t>(&hostinfo), | 71                          reinterpret_cast<host_info_t>(&hostinfo), | 
| 72                          &count); | 72                          &count); | 
| 73   if (result != KERN_SUCCESS) { | 73   if (result != KERN_SUCCESS) { | 
| 74     NOTREACHED(); | 74     NOTREACHED(); | 
| 75     return 0; | 75     return 0; | 
| 76   } | 76   } | 
| 77   DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); | 77   DCHECK_EQ(HOST_BASIC_INFO_COUNT, count); | 
| 78   return static_cast<int64>(hostinfo.max_mem); | 78   return static_cast<int64>(hostinfo.max_mem); | 
| 79 } | 79 } | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 98 // static | 98 // static | 
| 99 std::string SysInfo::CPUModelName() { | 99 std::string SysInfo::CPUModelName() { | 
| 100   char name[256]; | 100   char name[256]; | 
| 101   size_t len = arraysize(name); | 101   size_t len = arraysize(name); | 
| 102   if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) | 102   if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) | 
| 103     return name; | 103     return name; | 
| 104   return std::string(); | 104   return std::string(); | 
| 105 } | 105 } | 
| 106 | 106 | 
| 107 }  // namespace base | 107 }  // namespace base | 
| OLD | NEW | 
|---|