scoped_launch_data.h 998 B

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