OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/platform_handle/platform_handle_private_thunks.h" | |
6 | |
7 #include <assert.h> | |
8 #include <stddef.h> | |
9 | |
10 #if defined(WIN32) | |
11 #define THUNK_EXPORT __declspec(dllexport) | |
12 #else | |
13 #define THUNK_EXPORT __attribute__((visibility("default"))) | |
14 #endif | |
15 | |
16 extern "C" { | |
17 | |
18 static MojoPlatformHandlePrivateThunks g_thunks = {0}; | |
19 | |
20 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, | |
21 MojoHandle* wrapper) { | |
22 assert(g_thunks.CreatePlatformHandleWrapper); | |
23 return g_thunks.CreatePlatformHandleWrapper(platform_handle, wrapper); | |
24 } | |
25 | |
26 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, | |
27 MojoPlatformHandle* platform_handle) { | |
28 assert(g_thunks.ExtractPlatformHandle); | |
29 return g_thunks.ExtractPlatformHandle(wrapper, platform_handle); | |
30 } | |
31 | |
32 extern "C" THUNK_EXPORT size_t MojoSetPlatformHandlePrivateThunks( | |
33 const MojoPlatformHandlePrivateThunks* thunks) { | |
34 if (thunks->size >= sizeof(g_thunks)) | |
35 g_thunks = *thunks; | |
36 return sizeof(g_thunks); | |
37 } | |
38 | |
39 } // extern "C" | |
OLD | NEW |