OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Note: This header should be compilable as C. | 5 // Note: This header should be compilable as C. |
6 | 6 |
7 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 7 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 MojoHandle* handles, | 129 MojoHandle* handles, |
130 uint32_t* num_handles, | 130 uint32_t* num_handles, |
131 MojoReadMessageFlags flags); | 131 MojoReadMessageFlags flags); |
132 MojoResult (*AllocMessage)(uint32_t num_bytes, | 132 MojoResult (*AllocMessage)(uint32_t num_bytes, |
133 const MojoHandle* handles, | 133 const MojoHandle* handles, |
134 uint32_t num_handles, | 134 uint32_t num_handles, |
135 MojoAllocMessageFlags flags, | 135 MojoAllocMessageFlags flags, |
136 MojoMessageHandle* message); | 136 MojoMessageHandle* message); |
137 MojoResult (*FreeMessage)(MojoMessageHandle message); | 137 MojoResult (*FreeMessage)(MojoMessageHandle message); |
138 MojoResult (*GetMessageBuffer)(MojoMessageHandle message, void** buffer); | 138 MojoResult (*GetMessageBuffer)(MojoMessageHandle message, void** buffer); |
| 139 MojoResult (*WrapPlatformHandle)( |
| 140 const struct MojoPlatformHandle* platform_handle, |
| 141 MojoHandle* mojo_handle); |
| 142 MojoResult (*UnwrapPlatformHandle)( |
| 143 MojoHandle mojo_handle, |
| 144 struct MojoPlatformHandle* platform_handle); |
| 145 MojoResult (*WrapPlatformSharedBufferHandle)( |
| 146 const struct MojoPlatformHandle* platform_handle, |
| 147 size_t num_bytes, |
| 148 MojoPlatformSharedBufferHandleFlags flags, |
| 149 MojoHandle* mojo_handle); |
| 150 MojoResult (*UnwrapPlatformSharedBufferHandle)( |
| 151 MojoHandle mojo_handle, |
| 152 struct MojoPlatformHandle* platform_handle, |
| 153 size_t* num_bytes, |
| 154 MojoPlatformSharedBufferHandleFlags* flags); |
139 }; | 155 }; |
140 #pragma pack(pop) | 156 #pragma pack(pop) |
141 | 157 |
142 | 158 |
143 #ifdef __cplusplus | 159 #ifdef __cplusplus |
144 // Intended to be called from the embedder. Returns a |MojoCore| initialized | 160 // Intended to be called from the embedder. Returns a |MojoCore| initialized |
145 // to contain pointers to each of the embedder's MojoCore functions. | 161 // to contain pointers to each of the embedder's MojoCore functions. |
146 inline MojoSystemThunks MojoMakeSystemThunks() { | 162 inline MojoSystemThunks MojoMakeSystemThunks() { |
147 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), | 163 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), |
148 MojoGetTimeTicksNow, | 164 MojoGetTimeTicksNow, |
(...skipping 18 matching lines...) Expand all Loading... |
167 MojoAddHandle, | 183 MojoAddHandle, |
168 MojoRemoveHandle, | 184 MojoRemoveHandle, |
169 MojoGetReadyHandles, | 185 MojoGetReadyHandles, |
170 MojoWatch, | 186 MojoWatch, |
171 MojoCancelWatch, | 187 MojoCancelWatch, |
172 MojoFuseMessagePipes, | 188 MojoFuseMessagePipes, |
173 MojoWriteMessageNew, | 189 MojoWriteMessageNew, |
174 MojoReadMessageNew, | 190 MojoReadMessageNew, |
175 MojoAllocMessage, | 191 MojoAllocMessage, |
176 MojoFreeMessage, | 192 MojoFreeMessage, |
177 MojoGetMessageBuffer}; | 193 MojoGetMessageBuffer, |
| 194 MojoWrapPlatformHandle, |
| 195 MojoUnwrapPlatformHandle, |
| 196 MojoWrapPlatformSharedBufferHandle, |
| 197 MojoUnwrapPlatformSharedBufferHandle}; |
178 return system_thunks; | 198 return system_thunks; |
179 } | 199 } |
180 #endif | 200 #endif |
181 | 201 |
182 | 202 |
183 // Use this type for the function found by dynamically discovering it in | 203 // Use this type for the function found by dynamically discovering it in |
184 // a DSO linked with mojo_system. For example: | 204 // a DSO linked with mojo_system. For example: |
185 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = | 205 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = |
186 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( | 206 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( |
187 // "MojoSetSystemThunks")); | 207 // "MojoSetSystemThunks")); |
188 // The expected size of |system_thunks} is returned. | 208 // The expected size of |system_thunks} is returned. |
189 // The contents of |system_thunks| are copied. | 209 // The contents of |system_thunks| are copied. |
190 typedef size_t (*MojoSetSystemThunksFn)( | 210 typedef size_t (*MojoSetSystemThunksFn)( |
191 const struct MojoSystemThunks* system_thunks); | 211 const struct MojoSystemThunks* system_thunks); |
192 | 212 |
193 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 213 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
OLD | NEW |