Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/crashpad/crashpad/util/mac/launchd.h

Issue 1505213004: Copy Crashpad into the Chrome tree instead of importing it via DEPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_UTIL_MAC_LAUNCHD_H_
16 #define CRASHPAD_UTIL_MAC_LAUNCHD_H_
17
18 #include <CoreFoundation/CoreFoundation.h>
19 #include <launch.h>
20
21 namespace crashpad {
22
23 #pragma clang diagnostic push
24 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
25
26 //! \{
27 //! \brief Wraps the `<launch.h>` function of the same name.
28 //!
29 //! The Mac OS X 10.10 SDK deprecates `<launch.h>`, although the functionality
30 //! it provides is still useful. These wrappers allow the deprecated functions
31 //! to be called without triggering deprecated-declaration warnings.
32
33 inline launch_data_t LaunchDataAlloc(launch_data_type_t type) {
34 return launch_data_alloc(type);
35 }
36
37 inline launch_data_type_t LaunchDataGetType(const launch_data_t data) {
38 return launch_data_get_type(data);
39 }
40
41 inline void LaunchDataFree(launch_data_t data) {
42 return launch_data_free(data);
43 }
44
45 inline bool LaunchDataDictInsert(launch_data_t dict,
46 const launch_data_t value,
47 const char* key) {
48 return launch_data_dict_insert(dict, value, key);
49 }
50
51 inline launch_data_t LaunchDataDictLookup(const launch_data_t dict,
52 const char* key) {
53 return launch_data_dict_lookup(dict, key);
54 }
55
56 inline size_t LaunchDataDictGetCount(launch_data_t dict) {
57 return launch_data_dict_get_count(dict);
58 }
59
60 inline bool LaunchDataArraySetIndex(launch_data_t array,
61 const launch_data_t value,
62 size_t index) {
63 return launch_data_array_set_index(array, value, index);
64 }
65
66 inline launch_data_t LaunchDataArrayGetIndex(launch_data_t array,
67 size_t index) {
68 return launch_data_array_get_index(array, index);
69 }
70
71 inline size_t LaunchDataArrayGetCount(launch_data_t array) {
72 return launch_data_array_get_count(array);
73 }
74
75 inline launch_data_t LaunchDataNewInteger(long long integer) {
76 return launch_data_new_integer(integer);
77 }
78
79 inline launch_data_t LaunchDataNewBool(bool boolean) {
80 return launch_data_new_bool(boolean);
81 }
82
83 inline launch_data_t LaunchDataNewReal(double real) {
84 return launch_data_new_real(real);
85 }
86
87 inline launch_data_t LaunchDataNewString(const char* string) {
88 return launch_data_new_string(string);
89 }
90
91 inline launch_data_t LaunchDataNewOpaque(const void* opaque, size_t size) {
92 return launch_data_new_opaque(opaque, size);
93 }
94
95 inline long long LaunchDataGetInteger(const launch_data_t data) {
96 return launch_data_get_integer(data);
97 }
98
99 inline bool LaunchDataGetBool(const launch_data_t data) {
100 return launch_data_get_bool(data);
101 }
102
103 inline double LaunchDataGetReal(const launch_data_t data) {
104 return launch_data_get_real(data);
105 }
106
107 inline const char* LaunchDataGetString(const launch_data_t data) {
108 return launch_data_get_string(data);
109 }
110
111 inline void* LaunchDataGetOpaque(const launch_data_t data) {
112 return launch_data_get_opaque(data);
113 }
114
115 inline size_t LaunchDataGetOpaqueSize(const launch_data_t data) {
116 return launch_data_get_opaque_size(data);
117 }
118
119 inline int LaunchDataGetErrno(const launch_data_t data) {
120 return launch_data_get_errno(data);
121 }
122
123 inline launch_data_t LaunchMsg(const launch_data_t data) {
124 return launch_msg(data);
125 }
126
127 //! \}
128
129 #pragma clang diagnostic pop
130
131 //! \brief Converts a Core Foundation-type property list to a launchd-type
132 //! `launch_data_t`.
133 //!
134 //! \param[in] property_cf The Core Foundation-type property list to convert.
135 //!
136 //! \return The converted launchd-type `launch_data_t`. The caller takes
137 //! ownership of the returned value. On error, returns `nullptr`.
138 //!
139 //! \note This function handles all `CFPropertyListRef` types except for
140 //! `CFDateRef`, because there’s no `launch_data_type_t` analogue. Not all
141 //! types supported in a launchd-type `launch_data_t` have
142 //! `CFPropertyListRef` analogues.
143 launch_data_t CFPropertyToLaunchData(CFPropertyListRef property_cf);
144
145 } // namespace crashpad
146
147 #endif // CRASHPAD_UTIL_MAC_LAUNCHD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698