scoped_ionotificationportref.h 827 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_
  5. #define BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_
  6. #include <IOKit/IOKitLib.h>
  7. #include "base/scoped_generic.h"
  8. namespace base::mac {
  9. namespace internal {
  10. struct ScopedIONotificationPortRefTraits {
  11. static IONotificationPortRef InvalidValue() { return nullptr; }
  12. static void Free(IONotificationPortRef object) {
  13. IONotificationPortDestroy(object);
  14. }
  15. };
  16. } // namepsace internal
  17. using ScopedIONotificationPortRef =
  18. ScopedGeneric<IONotificationPortRef,
  19. internal::ScopedIONotificationPortRefTraits>;
  20. } // namespace base::mac
  21. #endif // BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_