1 // Copyright 2012 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_LAUNCH_DATA_H_ 6 #define BASE_MAC_SCOPED_LAUNCH_DATA_H_ 7 8 #include <launch.h> 9 10 #include "base/scoped_generic.h" 11 12 // This file uses launch_data_t and related APIs, which are deprecated with no 13 // replacement. 14 #pragma clang diagnostic push 15 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 16 17 namespace base::mac { 18 19 namespace internal { 20 21 struct ScopedLaunchDataTraits { InvalidValueScopedLaunchDataTraits22 static launch_data_t InvalidValue() { return nullptr; } FreeScopedLaunchDataTraits23 static void Free(launch_data_t ldt) { launch_data_free(ldt); } 24 }; 25 26 } // namespace internal 27 28 // Just like std::unique_ptr<> but for launch_data_t. 29 using ScopedLaunchData = 30 ScopedGeneric<launch_data_t, internal::ScopedLaunchDataTraits>; 31 32 } // namespace base::mac 33 34 #pragma clang diagnostic pop // -Wdeprecated-declarations 35 36 #endif // BASE_MAC_SCOPED_LAUNCH_DATA_H_ 37