Ben Wagner | 7b56229 | 2018-09-19 22:31:07 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkUniqueCFRef_DEFINED |
| 9 | #define SkUniqueCFRef_DEFINED |
| 10 | |
| 11 | #include "SkTypes.h" // Keep this before any #ifdef ... |
| 12 | #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 13 | |
| 14 | #include "SkTemplates.h" |
| 15 | #include "SkTLogic.h" |
| 16 | |
| 17 | #include <CoreFoundation/CoreFoundation.h> |
| 18 | #include <memory> |
| 19 | |
Ben Wagner | 7b56229 | 2018-09-19 22:31:07 -0400 | [diff] [blame] | 20 | template <typename CFRef> using SkUniqueCFRef = |
| 21 | std::unique_ptr<skstd::remove_pointer_t<CFRef>, |
| 22 | SkFunctionWrapper<void, skstd::remove_pointer_t<CFTypeRef>, CFRelease>>; |
Ben Wagner | 7b56229 | 2018-09-19 22:31:07 -0400 | [diff] [blame] | 23 | |
| 24 | #endif |
| 25 | #endif |