Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FOUNDATION_UTIL_H_ | 5 #ifndef BASE_MAC_FOUNDATION_UTIL_H_ |
| 6 #define BASE_MAC_FOUNDATION_UTIL_H_ | 6 #define BASE_MAC_FOUNDATION_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 // |exec_name| - path to the binary | 95 // |exec_name| - path to the binary |
| 96 // returns - path to the application bundle, or empty on error | 96 // returns - path to the application bundle, or empty on error |
| 97 BASE_EXPORT FilePath GetAppBundlePath(const FilePath& exec_name); | 97 BASE_EXPORT FilePath GetAppBundlePath(const FilePath& exec_name); |
| 98 | 98 |
| 99 // Utility function to pull out a value from a dictionary, check its type, and | 99 // Utility function to pull out a value from a dictionary, check its type, and |
| 100 // return it. Returns NULL if the key is not present or of the wrong type. | 100 // return it. Returns NULL if the key is not present or of the wrong type. |
| 101 BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, | 101 BASE_EXPORT CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, |
| 102 CFStringRef key, | 102 CFStringRef key, |
| 103 CFTypeID expected_type); | 103 CFTypeID expected_type); |
| 104 | 104 |
| 105 BASE_EXPORT template<class T> | |
|
Mark Mentovai
2011/11/11 23:20:45
More of a typename than a class. You can fix CFCas
| |
| 106 T GetValueFromDictionary(CFDictionaryRef dict, CFStringRef key); | |
| 107 | |
| 105 // Retain/release calls for memory management in C++. | 108 // Retain/release calls for memory management in C++. |
| 106 BASE_EXPORT void NSObjectRetain(void* obj); | 109 BASE_EXPORT void NSObjectRetain(void* obj); |
| 107 BASE_EXPORT void NSObjectRelease(void* obj); | 110 BASE_EXPORT void NSObjectRelease(void* obj); |
| 108 | 111 |
| 109 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation | 112 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation |
| 110 // object (one derived from CFTypeRef) to the Foundation memory management | 113 // object (one derived from CFTypeRef) to the Foundation memory management |
| 111 // system. In a traditional managed-memory environment, cf_object is | 114 // system. In a traditional managed-memory environment, cf_object is |
| 112 // autoreleased and returned as an NSObject. In a garbage-collected | 115 // autoreleased and returned as an NSObject. In a garbage-collected |
| 113 // environment, cf_object is marked as eligible for garbage collection. | 116 // environment, cf_object is marked as eligible for garbage collection. |
| 114 // | 117 // |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 // by using the NSToCFCast methods above. | 275 // by using the NSToCFCast methods above. |
| 273 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 276 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
| 274 // Operator << can not be overloaded for ObjectiveC types as the compiler | 277 // Operator << can not be overloaded for ObjectiveC types as the compiler |
| 275 // can not distinguish between overloads for id with overloads for void*. | 278 // can not distinguish between overloads for id with overloads for void*. |
| 276 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 279 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
| 277 const CFErrorRef err); | 280 const CFErrorRef err); |
| 278 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 281 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
| 279 const CFStringRef str); | 282 const CFStringRef str); |
| 280 | 283 |
| 281 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 284 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
| OLD | NEW |