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