OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "mojo/public/platform/native/system_thunks.h" | 5 #include "mojo/public/platform/native/system_thunks.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 MojoResult MojoFreeMessage(MojoMessageHandle message) { | 236 MojoResult MojoFreeMessage(MojoMessageHandle message) { |
237 assert(g_thunks.FreeMessage); | 237 assert(g_thunks.FreeMessage); |
238 return g_thunks.FreeMessage(message); | 238 return g_thunks.FreeMessage(message); |
239 } | 239 } |
240 | 240 |
241 MojoResult MojoGetMessageBuffer(MojoMessageHandle message, void** buffer) { | 241 MojoResult MojoGetMessageBuffer(MojoMessageHandle message, void** buffer) { |
242 assert(g_thunks.GetMessageBuffer); | 242 assert(g_thunks.GetMessageBuffer); |
243 return g_thunks.GetMessageBuffer(message, buffer); | 243 return g_thunks.GetMessageBuffer(message, buffer); |
244 } | 244 } |
245 | 245 |
| 246 MojoResult MojoWrapPlatformHandle( |
| 247 const struct MojoPlatformHandle* platform_handle, |
| 248 MojoHandle* mojo_handle) { |
| 249 assert(g_thunks.WrapPlatformHandle); |
| 250 return g_thunks.WrapPlatformHandle(platform_handle, mojo_handle); |
| 251 } |
| 252 |
| 253 MojoResult MojoUnwrapPlatformHandle( |
| 254 MojoHandle mojo_handle, |
| 255 struct MojoPlatformHandle* platform_handle) { |
| 256 assert(g_thunks.UnwrapPlatformHandle); |
| 257 return g_thunks.UnwrapPlatformHandle(mojo_handle, platform_handle); |
| 258 } |
| 259 |
| 260 MojoResult MojoWrapPlatformSharedBufferHandle( |
| 261 const struct MojoPlatformHandle* platform_handle, |
| 262 size_t num_bytes, |
| 263 MojoPlatformSharedBufferHandleFlags flags, |
| 264 MojoHandle* mojo_handle) { |
| 265 assert(g_thunks.WrapPlatformSharedBufferHandle); |
| 266 return g_thunks.WrapPlatformSharedBufferHandle(platform_handle, num_bytes, |
| 267 flags, mojo_handle); |
| 268 } |
| 269 |
| 270 MojoResult MojoUnwrapPlatformSharedBufferHandle( |
| 271 MojoHandle mojo_handle, |
| 272 struct MojoPlatformHandle* platform_handle, |
| 273 size_t* num_bytes, |
| 274 MojoPlatformSharedBufferHandleFlags* flags) { |
| 275 assert(g_thunks.UnwrapPlatformSharedBufferHandle); |
| 276 return g_thunks.UnwrapPlatformSharedBufferHandle(mojo_handle, platform_handle, |
| 277 num_bytes, flags); |
| 278 } |
| 279 |
246 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( | 280 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( |
247 const MojoSystemThunks* system_thunks) { | 281 const MojoSystemThunks* system_thunks) { |
248 if (system_thunks->size >= sizeof(g_thunks)) | 282 if (system_thunks->size >= sizeof(g_thunks)) |
249 g_thunks = *system_thunks; | 283 g_thunks = *system_thunks; |
250 return sizeof(g_thunks); | 284 return sizeof(g_thunks); |
251 } | 285 } |
252 | 286 |
253 } // extern "C" | 287 } // extern "C" |
OLD | NEW |