| 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(MojoPlatformHandle platform_handle, |
| 247 MojoHandle* mojo_handle) { |
| 248 assert(g_thunks.WrapPlatformHandle); |
| 249 return g_thunks.WrapPlatformHandle(platform_handle, mojo_handle); |
| 250 } |
| 251 |
| 252 MojoResult MojoUnwrapPlatformHandle(MojoHandle mojo_handle, |
| 253 MojoPlatformHandle* platform_handle) { |
| 254 assert(g_thunks.UnwrapPlatformHandle); |
| 255 return g_thunks.UnwrapPlatformHandle(mojo_handle, platform_handle); |
| 256 } |
| 257 |
| 258 MojoResult MojoWrapPlatformSharedBufferHandle( |
| 259 MojoPlatformHandle platform_handle, |
| 260 size_t num_bytes, |
| 261 bool read_only, |
| 262 MojoHandle* mojo_handle) { |
| 263 assert(g_thunks.WrapPlatformSharedBufferHandle); |
| 264 return g_thunks.WrapPlatformSharedBufferHandle(platform_handle, num_bytes, |
| 265 read_only, mojo_handle); |
| 266 } |
| 267 |
| 268 MojoResult MojoUnwrapPlatformSharedBufferHandle( |
| 269 MojoHandle mojo_handle, |
| 270 MojoPlatformHandle* platform_handle, |
| 271 size_t* num_bytes, |
| 272 bool* read_only) { |
| 273 assert(g_thunks.UnwrapPlatformSharedBufferHandle); |
| 274 return g_thunks.UnwrapPlatformSharedBufferHandle(mojo_handle, platform_handle, |
| 275 num_bytes, read_only); |
| 276 } |
| 277 |
| 246 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( | 278 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( |
| 247 const MojoSystemThunks* system_thunks) { | 279 const MojoSystemThunks* system_thunks) { |
| 248 if (system_thunks->size >= sizeof(g_thunks)) | 280 if (system_thunks->size >= sizeof(g_thunks)) |
| 249 g_thunks = *system_thunks; | 281 g_thunks = *system_thunks; |
| 250 return sizeof(g_thunks); | 282 return sizeof(g_thunks); |
| 251 } | 283 } |
| 252 | 284 |
| 253 } // extern "C" | 285 } // extern "C" |
| OLD | NEW |