scoped_ionotificationportref.h 853 B

123456789101112131415161718192021222324252627282930313233
  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 {
  9. namespace mac {
  10. namespace internal {
  11. struct ScopedIONotificationPortRefTraits {
  12. static IONotificationPortRef InvalidValue() { return nullptr; }
  13. static void Free(IONotificationPortRef object) {
  14. IONotificationPortDestroy(object);
  15. }
  16. };
  17. } // namepsace internal
  18. using ScopedIONotificationPortRef =
  19. ScopedGeneric<IONotificationPortRef,
  20. internal::ScopedIONotificationPortRefTraits>;
  21. } // namespace mac
  22. } // namespace base
  23. #endif // BASE_MAC_SCOPED_IONOTIFICATIONPORTREF_H_