summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h')
-rw-r--r--gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h b/gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h
new file mode 100644
index 0000000000..894a42adec
--- /dev/null
+++ b/gfx/skia/skia/src/utils/mac/SkUniqueCFRef.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkUniqueCFRef_DEFINED
+#define SkUniqueCFRef_DEFINED
+
+#include "include/core/SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+
+#include "include/private/base/SkTemplates.h"
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <memory>
+#include <type_traits>
+
+template <typename CFRef> using SkUniqueCFRef =
+ std::unique_ptr<std::remove_pointer_t<CFRef>, SkFunctionObject<CFRelease>>;
+
+#endif
+#endif