Chromium Code Reviews| Index: base/mac/scoped_ionotificationportref.h |
| diff --git a/base/mac/scoped_ionotificationportref.h b/base/mac/scoped_ionotificationportref.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..894debf04167ce01ba8d58109fd39f7c7f32f8ef |
| --- /dev/null |
| +++ b/base/mac/scoped_ionotificationportref.h |
| @@ -0,0 +1,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 |
|
Robert Sesek
2016/10/06 18:58:53
nit: needs trailing _
|
| +#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 |