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 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 #include <mach/mach.h> | 8 #include <mach/mach.h> |
9 #include <sys/sysctl.h> | 9 #include <sys/sysctl.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/mac/scoped_mach_port.h" | 13 #include "base/mac/scoped_mach_port.h" |
14 #include "base/mac/scoped_nsautorelease_pool.h" | 14 #include "base/mac/scoped_nsautorelease_pool.h" |
15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 | 18 |
19 bool SysInfo::HasSeekPenalty(const FilePath& path, bool* has_seek_penalty) { | |
20 // Find a case where this is incorrect and dbeam@ will buy you a beer. | |
21 *has_seek_penalty = false; | |
22 return true; | |
23 } | |
24 | |
25 // static | 19 // static |
26 std::string SysInfo::OperatingSystemName() { | 20 std::string SysInfo::OperatingSystemName() { |
27 static dispatch_once_t get_system_name_once; | 21 static dispatch_once_t get_system_name_once; |
28 static std::string* system_name; | 22 static std::string* system_name; |
29 dispatch_once(&get_system_name_once, ^{ | 23 dispatch_once(&get_system_name_once, ^{ |
30 base::mac::ScopedNSAutoreleasePool pool; | 24 base::mac::ScopedNSAutoreleasePool pool; |
31 system_name = new std::string( | 25 system_name = new std::string( |
32 SysNSStringToUTF8([[UIDevice currentDevice] systemName])); | 26 SysNSStringToUTF8([[UIDevice currentDevice] systemName])); |
33 }); | 27 }); |
34 // Examples of returned value: 'iPhone OS' on iPad 5.1.1 | 28 // Examples of returned value: 'iPhone OS' on iPad 5.1.1 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // static | 98 // static |
105 std::string SysInfo::CPUModelName() { | 99 std::string SysInfo::CPUModelName() { |
106 char name[256]; | 100 char name[256]; |
107 size_t len = arraysize(name); | 101 size_t len = arraysize(name); |
108 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) | 102 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) |
109 return name; | 103 return name; |
110 return std::string(); | 104 return std::string(); |
111 } | 105 } |
112 | 106 |
113 } // namespace base | 107 } // namespace base |
OLD | NEW |