xref: /aosp_15_r20/external/skia/src/utils/mac/SkUniqueCFRef.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 "include/core/SkTypes.h"
12 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
13 
14 #include "include/private/base/SkTemplates.h"
15 
16 #include <CoreFoundation/CoreFoundation.h>
17 #include <memory>
18 #include <type_traits>
19 
20 template <typename CFRef> using SkUniqueCFRef =
21     std::unique_ptr<std::remove_pointer_t<CFRef>, SkFunctionObject<CFRelease>>;
22 
23 #endif
24 #endif
25