scoped_launch_data.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 {
  13. namespace mac {
  14. namespace internal {
  15. struct ScopedLaunchDataTraits {
  16. static launch_data_t InvalidValue() { return nullptr; }
  17. static void Free(launch_data_t ldt) { launch_data_free(ldt); }
  18. };
  19. } // namespace internal
  20. // Just like std::unique_ptr<> but for launch_data_t.
  21. using ScopedLaunchData =
  22. ScopedGeneric<launch_data_t, internal::ScopedLaunchDataTraits>;
  23. } // namespace mac
  24. } // namespace base
  25. #pragma clang diagnostic pop // -Wdeprecated-declarations
  26. #endif // BASE_MAC_SCOPED_LAUNCH_DATA_H_