Roll src/third_party/WebKit 56db356:7227c61 (svn 201871:201874)
[chromium-blink-merge.git] / mojo / platform_handle / platform_handle_private_thunks.cc
blob1b210986a2e87c3138a916ee63d32cbe47b5643d
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.
5 #include "mojo/platform_handle/platform_handle_private_thunks.h"
7 #include <assert.h>
9 #if defined(WIN32)
10 #define THUNK_EXPORT __declspec(dllexport)
11 #else
12 #define THUNK_EXPORT __attribute__((visibility("default")))
13 #endif
15 extern "C" {
17 static MojoPlatformHandlePrivateThunks g_thunks = {0};
19 MojoResult MojoCreatePlatformHandleWrapper(MojoPlatformHandle platform_handle,
20 MojoHandle* wrapper) {
21 assert(g_thunks.CreatePlatformHandleWrapper);
22 return g_thunks.CreatePlatformHandleWrapper(platform_handle, wrapper);
25 MojoResult MojoExtractPlatformHandle(MojoHandle wrapper,
26 MojoPlatformHandle* platform_handle) {
27 assert(g_thunks.ExtractPlatformHandle);
28 return g_thunks.ExtractPlatformHandle(wrapper, platform_handle);
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);
38 } // extern "C"