| 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/c/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 |
| 11 #include "mojo/public/platform/native/thunk_export.h" | |
| 12 | |
| 13 extern "C" { | 11 extern "C" { |
| 14 | 12 |
| 15 static MojoSystemThunks g_thunks = {0}; | 13 static MojoSystemThunks g_thunks = {0}; |
| 16 | 14 |
| 17 MojoTimeTicks MojoGetTimeTicksNow() { | 15 MojoTimeTicks MojoGetTimeTicksNow() { |
| 18 assert(g_thunks.GetTimeTicksNow); | 16 assert(g_thunks.GetTimeTicksNow); |
| 19 return g_thunks.GetTimeTicksNow(); | 17 return g_thunks.GetTimeTicksNow(); |
| 20 } | 18 } |
| 21 | 19 |
| 22 MojoResult MojoClose(MojoHandle handle) { | 20 MojoResult MojoClose(MojoHandle handle) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 MojoResult MojoUnwrapPlatformSharedBufferHandle( | 268 MojoResult MojoUnwrapPlatformSharedBufferHandle( |
| 271 MojoHandle mojo_handle, | 269 MojoHandle mojo_handle, |
| 272 struct MojoPlatformHandle* platform_handle, | 270 struct MojoPlatformHandle* platform_handle, |
| 273 size_t* num_bytes, | 271 size_t* num_bytes, |
| 274 MojoPlatformSharedBufferHandleFlags* flags) { | 272 MojoPlatformSharedBufferHandleFlags* flags) { |
| 275 assert(g_thunks.UnwrapPlatformSharedBufferHandle); | 273 assert(g_thunks.UnwrapPlatformSharedBufferHandle); |
| 276 return g_thunks.UnwrapPlatformSharedBufferHandle(mojo_handle, platform_handle, | 274 return g_thunks.UnwrapPlatformSharedBufferHandle(mojo_handle, platform_handle, |
| 277 num_bytes, flags); | 275 num_bytes, flags); |
| 278 } | 276 } |
| 279 | 277 |
| 280 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( | 278 } // extern "C" |
| 281 const MojoSystemThunks* system_thunks) { | 279 |
| 280 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { |
| 282 if (system_thunks->size >= sizeof(g_thunks)) | 281 if (system_thunks->size >= sizeof(g_thunks)) |
| 283 g_thunks = *system_thunks; | 282 g_thunks = *system_thunks; |
| 284 return sizeof(g_thunks); | 283 return sizeof(g_thunks); |
| 285 } | 284 } |
| 286 | |
| 287 } // extern "C" | |
| OLD | NEW |