OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/public/platform/native/gles2_thunks.h" | 5 #include "mojo/public/platform/native/gles2_thunks.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 | 8 |
9 #include "mojo/public/platform/native/thunk_export.h" | 9 #include "mojo/public/platform/native/thunk_export.h" |
10 | 10 |
11 extern "C" { | 11 extern "C" { |
12 | 12 |
13 static MojoGLES2ControlThunks g_control_thunks = {0}; | 13 static MojoGLES2ControlThunks g_control_thunks = {0}; |
14 static MojoGLES2ImplThunks g_impl_thunks = {0}; | 14 static MojoGLES2ImplThunks g_impl_thunks = {0}; |
15 | 15 |
16 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { | 16 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, |
17 assert(g_control_thunks.GLES2Initialize); | 17 MojoGLES2ContextLost lost_callback, |
18 g_control_thunks.GLES2Initialize(async_waiter); | 18 void* closure, |
19 } | 19 const MojoAsyncWaiter* async_waiter) { |
20 | |
21 void MojoGLES2Terminate() { | |
22 assert(g_control_thunks.GLES2Terminate); | |
23 g_control_thunks.GLES2Terminate(); | |
24 } | |
25 | |
26 MojoGLES2Context MojoGLES2CreateContext( | |
27 MojoHandle handle, | |
28 MojoGLES2ContextLost lost_callback, | |
29 void* closure) { | |
30 assert(g_control_thunks.GLES2CreateContext); | 20 assert(g_control_thunks.GLES2CreateContext); |
31 return g_control_thunks.GLES2CreateContext(handle, lost_callback, closure); | 21 return g_control_thunks.GLES2CreateContext( |
| 22 handle, lost_callback, closure, async_waiter); |
32 } | 23 } |
33 | 24 |
34 void MojoGLES2DestroyContext(MojoGLES2Context context) { | 25 void MojoGLES2DestroyContext(MojoGLES2Context context) { |
35 assert(g_control_thunks.GLES2DestroyContext); | 26 assert(g_control_thunks.GLES2DestroyContext); |
36 g_control_thunks.GLES2DestroyContext(context); | 27 g_control_thunks.GLES2DestroyContext(context); |
37 } | 28 } |
38 | 29 |
39 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | 30 void MojoGLES2MakeCurrent(MojoGLES2Context context) { |
40 assert(g_control_thunks.GLES2MakeCurrent); | 31 assert(g_control_thunks.GLES2MakeCurrent); |
41 g_control_thunks.GLES2MakeCurrent(context); | 32 g_control_thunks.GLES2MakeCurrent(context); |
(...skipping 30 matching lines...) Expand all Loading... |
72 } | 63 } |
73 | 64 |
74 extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplThunks( | 65 extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplThunks( |
75 const MojoGLES2ImplThunks* gles2_impl_thunks) { | 66 const MojoGLES2ImplThunks* gles2_impl_thunks) { |
76 if (gles2_impl_thunks->size >= sizeof(g_impl_thunks)) | 67 if (gles2_impl_thunks->size >= sizeof(g_impl_thunks)) |
77 g_impl_thunks = *gles2_impl_thunks; | 68 g_impl_thunks = *gles2_impl_thunks; |
78 return sizeof(g_impl_thunks); | 69 return sizeof(g_impl_thunks); |
79 } | 70 } |
80 | 71 |
81 } // extern "C" | 72 } // extern "C" |
OLD | NEW |