OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
10 #include <mach/mach_host.h> | 10 #include <mach/mach_host.h> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 NSOperatingSystemVersion version = [processInfo operatingSystemVersion]; | 44 NSOperatingSystemVersion version = [processInfo operatingSystemVersion]; |
45 *major_version = version.majorVersion; | 45 *major_version = version.majorVersion; |
46 *minor_version = version.minorVersion; | 46 *minor_version = version.minorVersion; |
47 *bugfix_version = version.patchVersion; | 47 *bugfix_version = version.patchVersion; |
48 } else { | 48 } else { |
49 // -[NSProcessInfo operatingSystemVersion] is documented available in 10.10. | 49 // -[NSProcessInfo operatingSystemVersion] is documented available in 10.10. |
50 // It's also available via a private API since 10.9.2. For the remaining | 50 // It's also available via a private API since 10.9.2. For the remaining |
51 // cases in 10.9, rely on ::Gestalt(..). Since this code is only needed for | 51 // cases in 10.9, rely on ::Gestalt(..). Since this code is only needed for |
52 // 10.9.0 and 10.9.1 and uses the recommended replacement thereafter, | 52 // 10.9.0 and 10.9.1 and uses the recommended replacement thereafter, |
53 // suppress the warning for this fallback case. | 53 // suppress the warning for this fallback case. |
54 DCHECK(base::mac::IsOS10_9()); | 54 DCHECK(!base::mac::IsAtLeastOS10_10()); |
Nico
2016/08/29 19:44:23
Hm, the lhs seems better to me. When we dropped ol
Sidney San Martín
2016/08/30 15:27:04
FWIW, grepping doesn't get any harder. When we dro
Sidney San Martín
2016/08/30 15:27:55
See latest patch set.
| |
55 #pragma clang diagnostic push | 55 #pragma clang diagnostic push |
56 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 56 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
57 Gestalt(gestaltSystemVersionMajor, | 57 Gestalt(gestaltSystemVersionMajor, |
58 reinterpret_cast<SInt32*>(major_version)); | 58 reinterpret_cast<SInt32*>(major_version)); |
59 Gestalt(gestaltSystemVersionMinor, | 59 Gestalt(gestaltSystemVersionMinor, |
60 reinterpret_cast<SInt32*>(minor_version)); | 60 reinterpret_cast<SInt32*>(minor_version)); |
61 Gestalt(gestaltSystemVersionBugFix, | 61 Gestalt(gestaltSystemVersionBugFix, |
62 reinterpret_cast<SInt32*>(bugfix_version)); | 62 reinterpret_cast<SInt32*>(bugfix_version)); |
63 #pragma clang diagnostic pop | 63 #pragma clang diagnostic pop |
64 } | 64 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 | 110 |
111 std::string SysInfo::HardwareModelName() { | 111 std::string SysInfo::HardwareModelName() { |
112 char model[256]; | 112 char model[256]; |
113 size_t len = sizeof(model); | 113 size_t len = sizeof(model); |
114 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0) | 114 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0) |
115 return std::string(model, 0, len); | 115 return std::string(model, 0, len); |
116 return std::string(); | 116 return std::string(); |
117 } | 117 } |
118 | 118 |
119 } // namespace base | 119 } // namespace base |
OLD | NEW |