| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ECHO_THUNKS_H_ | |
| 6 #define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ECHO_THUNKS_H_ | |
| 7 | |
| 8 #include <MGL/mgl_echo.h> | |
| 9 #include <stddef.h> | |
| 10 | |
| 11 // Structure used to bind the MGL echo interface DSO to those of the embedder. | |
| 12 // | |
| 13 // This is the ABI between the embedder and the DSO. It can only have new | |
| 14 // functions added to the end. No other changes are supported. | |
| 15 #pragma pack(push, 8) | |
| 16 struct MGLEchoThunks { | |
| 17 size_t size; // Should be set to sizeof(MGLEchoThunks). | |
| 18 | |
| 19 void (*MGLEcho)(MGLEchoCallback callback, void* lost_callback_closure); | |
| 20 }; | |
| 21 #pragma pack(pop) | |
| 22 | |
| 23 #ifdef __cplusplus | |
| 24 // Intended to be called from the embedder. Returns an object initialized to | |
| 25 // contain pointers to each of the embedder's MGLEchoThunks | |
| 26 // functions. | |
| 27 inline struct MGLEchoThunks MojoMakeMGLEchoThunks() { | |
| 28 struct MGLEchoThunks mgl_thunks = { | |
| 29 sizeof(struct MGLEchoThunks), MGLEcho, | |
| 30 }; | |
| 31 | |
| 32 return mgl_thunks; | |
| 33 } | |
| 34 #endif // __cplusplus | |
| 35 | |
| 36 // Use this type for the function found by dynamically discovering it in | |
| 37 // a DSO linked with mojo_system. For example: | |
| 38 // MojoSetMGLEchoThunksFn mojo_set_gles2_thunks_fn = | |
| 39 // reinterpret_cast<MojoSetMGLEchoThunksFn>( | |
| 40 // app_library.GetFunctionPointer("MojoSetMGLEchoThunks")); | |
| 41 // The expected size of |mgl_thunks| is returned. | |
| 42 // The contents of |mgl_thunks| are copied. | |
| 43 typedef size_t (*MojoSetMGLEchoThunksFn)( | |
| 44 const struct MGLEchoThunks* mgl_echo_thunks); | |
| 45 | |
| 46 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ECHO_THUNKS_H_ | |
| OLD | NEW |