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