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