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 | |
9 #if defined(WIN32) | |
10 #define THUNK_EXPORT __declspec(dllexport) | |
11 #else | |
12 #define THUNK_EXPORT __attribute__((visibility("default"))) | |
13 #endif | |
14 | |
15 extern "C" { | |
16 | |
17 static MojoPlatformHandlePrivateThunks g_thunks = {0}; | |
18 | |
19 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle, | |
20 MojoHandle* wrapper) { | |
21 assert(g_thunks.CreatePlatformHandleWrapper); | |
22 return g_thunks.CreatePlatformHandleWrapper(platform_handle, wrapper); | |
23 } | |
24 | |
25 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper, | |
26 MojoPlatformHandle* platform_handle) { | |
27 assert(g_thunks.ExtractPlatformHandle); | |
28 return g_thunks.ExtractPlatformHandle(wrapper, platform_handle); | |
29 } | |
30 | |
31 extern "C" THUNK_EXPORT size_t MojoSetPlatformHandlePrivateThunks( | |
32 const MojoPlatformHandlePrivateThunks* thunks) { | |
33 if (thunks->size >= sizeof(g_thunks)) | |
34 g_thunks = *thunks; | |
35 return sizeof(g_thunks); | |
36 } | |
37 | |
38 } // extern "C" | |
OLD | NEW |