admin
2022-10-28 086ec74e94654e92b3a1c6f42612d12ef33ff4b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
#ifndef MINI_CHROMIUM_BASE_MAC_SCOPED_CFTYPEREF_H_
#define MINI_CHROMIUM_BASE_MAC_SCOPED_CFTYPEREF_H_
 
#include <CoreFoundation/CoreFoundation.h>
 
#include "base/mac/scoped_typeref.h"
 
namespace base {
 
namespace internal {
 
template <typename CFT>
struct ScopedCFTypeRefTraits {
  static CFT InvalidValue() { return nullptr; }
  static CFT Retain(CFT object) {
    CFRetain(object);
    return object;
  }
  static void Release(CFT object) { CFRelease(object); }
};
 
}  // namespace internal
 
template <typename CFT>
using ScopedCFTypeRef =
    ScopedTypeRef<CFT, internal::ScopedCFTypeRefTraits<CFT>>;
 
}  // namespace base
 
#endif  // MINI_CHROMIUM_BASE_MAC_SCOPED_CFTYPEREF_H_