OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/nacl/nonsfi/irt_mojo_nonsfi.h" | 5 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
6 | 6 |
7 #include "mojo/public/c/system/functions.h" | 7 #include "mojo/public/c/system/functions.h" |
| 8 #include "mojo/public/platform/nacl/mgl_irt.h" |
8 #include "mojo/public/platform/nacl/mojo_irt.h" | 9 #include "mojo/public/platform/nacl/mojo_irt.h" |
9 #include "native_client/src/public/irt_core.h" | 10 #include "native_client/src/public/irt_core.h" |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID; | 14 MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID; |
14 | 15 |
15 MojoResult _MojoGetInitialHandle(MojoHandle* handle) { | 16 MojoResult _MojoGetInitialHandle(MojoHandle* handle) { |
16 *handle = g_mojo_handle; | 17 *handle = g_mojo_handle; |
17 return MOJO_RESULT_OK; | 18 return MOJO_RESULT_OK; |
(...skipping 14 matching lines...) Expand all Loading... |
32 MojoGetTimeTicksNow, | 33 MojoGetTimeTicksNow, |
33 MojoClose, | 34 MojoClose, |
34 MojoWait, | 35 MojoWait, |
35 MojoWaitMany, | 36 MojoWaitMany, |
36 MojoCreateMessagePipe, | 37 MojoCreateMessagePipe, |
37 MojoWriteMessage, | 38 MojoWriteMessage, |
38 MojoReadMessage, | 39 MojoReadMessage, |
39 _MojoGetInitialHandle, | 40 _MojoGetInitialHandle, |
40 }; | 41 }; |
41 | 42 |
| 43 const struct nacl_irt_mgl kIrtMGL = { |
| 44 MGLCreateContext, |
| 45 MGLDestroyContext, |
| 46 MGLMakeCurrent, |
| 47 MGLGetCurrentContext, |
| 48 MGLGetProcAddress, |
| 49 }; |
| 50 |
| 51 const struct nacl_irt_mgl_onscreen kIrtMGLOnScreen = { |
| 52 MGLResizeSurface, |
| 53 MGLSwapBuffers, |
| 54 }; |
| 55 |
| 56 const struct nacl_irt_mgl_signal_sync_point kIrtMGLSignalSyncPoint = { |
| 57 MGLSignalSyncPoint, |
| 58 }; |
| 59 |
42 const struct nacl_irt_interface kIrtInterfaces[] = { | 60 const struct nacl_irt_interface kIrtInterfaces[] = { |
43 {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}}; | 61 {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}, |
| 62 {NACL_IRT_MGL_v0_1, &kIrtMGL, sizeof(kIrtMGL), nullptr}, |
| 63 {NACL_IRT_MGL_ONSCREEN_v0_1, &kIrtMGLOnScreen, sizeof(kIrtMGLOnScreen), |
| 64 nullptr}, |
| 65 {NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1, &kIrtMGLSignalSyncPoint, |
| 66 sizeof(kIrtMGLSignalSyncPoint), nullptr}, |
| 67 }; |
44 | 68 |
45 } // namespace | 69 } // namespace |
46 | 70 |
47 namespace nacl { | 71 namespace nacl { |
48 | 72 |
49 void MojoSetInitialHandle(MojoHandle handle) { | 73 void MojoSetInitialHandle(MojoHandle handle) { |
50 g_mojo_handle = handle; | 74 g_mojo_handle = handle; |
51 } | 75 } |
52 | 76 |
53 size_t MojoIrtNonsfiQuery(const char* interface_ident, | 77 size_t MojoIrtNonsfiQuery(const char* interface_ident, |
54 void* table, | 78 void* table, |
55 size_t tablesize) { | 79 size_t tablesize) { |
56 size_t result = nacl_irt_query_list(interface_ident, table, tablesize, | 80 size_t result = nacl_irt_query_list(interface_ident, table, tablesize, |
57 kIrtInterfaces, sizeof(kIrtInterfaces)); | 81 kIrtInterfaces, sizeof(kIrtInterfaces)); |
58 if (result != 0) | 82 if (result != 0) |
59 return result; | 83 return result; |
60 return nacl_irt_query_core(interface_ident, table, tablesize); | 84 return nacl_irt_query_core(interface_ident, table, tablesize); |
61 } | 85 } |
62 | 86 |
63 } // namespace nacl | 87 } // namespace nacl |
OLD | NEW |