OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_MAC_SCOPED_LAUNCH_DATA_H_ | 5 #ifndef BASE_MAC_SCOPED_LAUNCH_DATA_H_ |
6 #define BASE_MAC_SCOPED_LAUNCH_DATA_H_ | 6 #define BASE_MAC_SCOPED_LAUNCH_DATA_H_ |
7 | 7 |
8 #include <launch.h> | 8 #include <launch.h> |
9 | 9 |
10 #include "base/scoped_generic.h" | 10 #include "base/scoped_generic.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 namespace mac { | 13 namespace mac { |
14 | 14 |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 struct ScopedLaunchDataTraits { | 17 struct ScopedLaunchDataTraits { |
18 static launch_data_t InvalidValue() { return nullptr; } | 18 static launch_data_t InvalidValue() { return nullptr; } |
19 static void Free(launch_data_t ldt) { launch_data_free(ldt); } | 19 static void Free(launch_data_t ldt) { launch_data_free(ldt); } |
20 }; | 20 }; |
21 | 21 |
22 } // namespace internal | 22 } // namespace internal |
23 | 23 |
24 // Just like scoped_ptr<> but for launch_data_t. | 24 // Just like std::unique_ptr<> but for launch_data_t. |
25 using ScopedLaunchData = | 25 using ScopedLaunchData = |
26 ScopedGeneric<launch_data_t, internal::ScopedLaunchDataTraits>; | 26 ScopedGeneric<launch_data_t, internal::ScopedLaunchDataTraits>; |
27 | 27 |
28 } // namespace mac | 28 } // namespace mac |
29 } // namespace base | 29 } // namespace base |
30 | 30 |
31 #endif // BASE_MAC_SCOPED_LAUNCH_DATA_H_ | 31 #endif // BASE_MAC_SCOPED_LAUNCH_DATA_H_ |
OLD | NEW |