summaryrefslogtreecommitdiff
path: root/chromium/base/mac/scoped_ionotificationportref.h
blob: 93ebc98b65bbbc56ad66588a054bccb51912636a (plain)
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
// Copyright 2016 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 BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_
#define BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_

#include <IOKit/IOKitLib.h>

#include "base/scoped_generic.h"

namespace base {
namespace mac {

namespace internal {

struct ScopedIONotificationPortRefTraits {
  static IONotificationPortRef InvalidValue() { return nullptr; }
  static void Free(IONotificationPortRef object) {
    IONotificationPortDestroy(object);
  }
};

}  // namepsace internal

using ScopedIONotificationPortRef =
    ScopedGeneric<IONotificationPortRef,
                  internal::ScopedIONotificationPortRefTraits>;

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_