blob: f5086ac692023060340ac74dabbf27be114b034e [file] [log] [blame]
Ben Wagner7b562292018-09-19 22:31:07 -04001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkTypes.h"
Ben Wagner7b562292018-09-19 22:31:07 -040012#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
13
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "include/private/SkTemplates.h"
Ben Wagner7b562292018-09-19 22:31:07 -040015
16#include <CoreFoundation/CoreFoundation.h>
17#include <memory>
Mike Kleindc976a92020-04-30 06:45:25 -050018#include <type_traits>
Ben Wagner7b562292018-09-19 22:31:07 -040019
Ben Wagner7b562292018-09-19 22:31:07 -040020template <typename CFRef> using SkUniqueCFRef =
Mike Kleindc976a92020-04-30 06:45:25 -050021 std::unique_ptr<std::remove_pointer_t<CFRef>,
Ben Wagner723a8772019-08-16 11:36:58 -040022 SkFunctionWrapper<decltype(CFRelease), CFRelease>>;
Ben Wagner7b562292018-09-19 22:31:07 -040023
24#endif
25#endif