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

Side by Side Diff: base/mac/mac_util.h

Issue 2129273002: mac: Update knowledge of CFAllocator internals for 10.12 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Diet Created 4 years, 5 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
« no previous file with comments | « no previous file | base/mac/mac_util.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BASE_MAC_MAC_UTIL_H_ 5 #ifndef BASE_MAC_MAC_UTIL_H_
6 #define BASE_MAC_MAC_UTIL_H_ 6 #define BASE_MAC_MAC_UTIL_H_
7 7
8 #include <AvailabilityMacros.h> 8 #include <AvailabilityMacros.h>
9 #include <Carbon/Carbon.h> 9 #include <Carbon/Carbon.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Remove the quarantine xattr from the given file. Returns false if there was 107 // Remove the quarantine xattr from the given file. Returns false if there was
108 // an error, or true otherwise. 108 // an error, or true otherwise.
109 BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path); 109 BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path);
110 110
111 // Run-time OS version checks. Use these instead of 111 // Run-time OS version checks. Use these instead of
112 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and 112 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and
113 // "OrLater" variants to those that check for a specific version, unless you 113 // "OrLater" variants to those that check for a specific version, unless you
114 // know for sure that you need to check for a specific version. 114 // know for sure that you need to check for a specific version.
115 115
116 // Mavericks is Mac OS X 10.9, Darwin 13. 116 // Mavericks is OS X 10.9, Darwin 13.
117 BASE_EXPORT bool IsOSMavericks(); 117 BASE_EXPORT bool IsOSMavericks();
118 BASE_EXPORT bool IsOSMavericksOrLater(); 118 BASE_EXPORT bool IsOSMavericksOrLater();
119 119
120 // Yosemite is Mac OS X 10.10, Darwin 14. 120 // Yosemite is OS X 10.10, Darwin 14.
121 BASE_EXPORT bool IsOSYosemite(); 121 BASE_EXPORT bool IsOSYosemite();
122 BASE_EXPORT bool IsOSYosemiteOrEarlier(); 122 BASE_EXPORT bool IsOSYosemiteOrEarlier();
123 BASE_EXPORT bool IsOSYosemiteOrLater(); 123 BASE_EXPORT bool IsOSYosemiteOrLater();
124 124
125 // El Capitan is Mac OS X 10.11, Darwin 15. 125 // El Capitan is OS X 10.11, Darwin 15.
126 BASE_EXPORT bool IsOSElCapitan(); 126 BASE_EXPORT bool IsOSElCapitan();
127 BASE_EXPORT bool IsOSElCapitanOrEarlier();
127 BASE_EXPORT bool IsOSElCapitanOrLater(); 128 BASE_EXPORT bool IsOSElCapitanOrLater();
128 129
130 // Sierra is macOS 10.12, Darwin 16.
131 BASE_EXPORT bool IsOSSierra();
132 BASE_EXPORT bool IsOSSierraOrLater();
133
129 // This should be infrequently used. It only makes sense to use this to avoid 134 // This should be infrequently used. It only makes sense to use this to avoid
130 // codepaths that are very likely to break on future (unreleased, untested, 135 // codepaths that are very likely to break on future (unreleased, untested,
131 // unborn) OS releases, or to log when the OS is newer than any known version. 136 // unborn) OS releases, or to log when the OS is newer than any known version.
132 BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis(); 137 BASE_EXPORT bool IsOSLaterThanSierra_DontCallThis();
133 138
134 // Inline functions that are redundant due to version ranges being mutually- 139 // Inline functions that are redundant due to version ranges being mutually-
135 // exclusive. 140 // exclusive.
136 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); } 141 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); }
142 inline bool IsOSElCapitanOrEarlier() { return !IsOSSierraOrLater(); }
137 143
138 // When the deployment target is set, the code produced cannot run on earlier 144 // When the deployment target is set, the code produced cannot run on earlier
139 // OS releases. That enables some of the IsOS* family to be implemented as 145 // OS releases. That enables some of the IsOS* family to be implemented as
140 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro 146 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
141 // contains the value of the deployment target. 147 // contains the value of the deployment target.
142 148
143 #if defined(MAC_OS_X_VERSION_10_9) && \ 149 #if defined(MAC_OS_X_VERSION_10_9) && \
144 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 150 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
145 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9 151 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9
146 inline bool IsOSMavericksOrLater() { return true; } 152 inline bool IsOSMavericksOrLater() { return true; }
(...skipping 20 matching lines...) Expand all
167 #if defined(MAC_OS_X_VERSION_10_11) && \ 173 #if defined(MAC_OS_X_VERSION_10_11) && \
168 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11 174 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
169 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11 175 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11
170 inline bool IsOSElCapitanOrLater() { return true; } 176 inline bool IsOSElCapitanOrLater() { return true; }
171 #endif 177 #endif
172 178
173 #if defined(MAC_OS_X_VERSION_10_11) && \ 179 #if defined(MAC_OS_X_VERSION_10_11) && \
174 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11 180 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11
175 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11 181 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11
176 inline bool IsOSElCapitan() { return false; } 182 inline bool IsOSElCapitan() { return false; }
177 inline bool IsOSLaterThanElCapitan_DontCallThis() { return true; } 183 #endif
184
185 #if defined(MAC_OS_X_VERSION_10_12) && \
186 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
187 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_12
188 inline bool IsOSSierraOrLater() { return true; }
189 #endif
190
191 #if defined(MAC_OS_X_VERSION_10_12) && \
192 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12
193 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_12
194 inline bool IsOSSierra() { return false; }
195 inline bool IsOSLaterThanSierra_DontCallThis() { return true; }
178 #endif 196 #endif
179 197
180 // Retrieve the system's model identifier string from the IOKit registry: 198 // Retrieve the system's model identifier string from the IOKit registry:
181 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon 199 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon
182 // failure. 200 // failure.
183 BASE_EXPORT std::string GetModelIdentifier(); 201 BASE_EXPORT std::string GetModelIdentifier();
184 202
185 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). 203 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1).
186 // If any error occurs, none of the input pointers are touched. 204 // If any error occurs, none of the input pointers are touched.
187 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, 205 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident,
188 std::string* type, 206 std::string* type,
189 int32_t* major, 207 int32_t* major,
190 int32_t* minor); 208 int32_t* minor);
191 209
192 } // namespace mac 210 } // namespace mac
193 } // namespace base 211 } // namespace base
194 212
195 #endif // BASE_MAC_MAC_UTIL_H_ 213 #endif // BASE_MAC_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/mac/mac_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698