Chromium Code Reviews| Index: mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| diff --git a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| index 4fed496dda4c831685e0759dcf5b0b5efc30f5ad..4b0090e5c4ec6612ba6e66da887e9cdd49039dfc 100644 |
| --- a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| +++ b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| @@ -8,15 +8,12 @@ |
| #include "mojo/public/platform/nacl/mgl_irt.h" |
| #include "mojo/public/platform/nacl/mojo_irt.h" |
| #include "native_client/src/public/irt_core.h" |
| +#include "native_client/src/untrusted/irt/irt_dev.h" |
| namespace { |
| MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID; |
| - |
| -MojoResult _MojoGetInitialHandle(MojoHandle* handle) { |
| - *handle = g_mojo_handle; |
| - return MOJO_RESULT_OK; |
| -} |
| +bool g_running_translator = false; |
| const struct nacl_irt_mojo kIrtMojo = { |
| MojoCreateSharedBuffer, |
| @@ -37,7 +34,7 @@ const struct nacl_irt_mojo kIrtMojo = { |
| MojoCreateMessagePipe, |
| MojoWriteMessage, |
| MojoReadMessage, |
| - _MojoGetInitialHandle, |
| + nacl::MojoGetInitialHandle, |
| }; |
| const struct nacl_irt_mgl kIrtMGL = { |
| @@ -57,8 +54,34 @@ const struct nacl_irt_mgl_signal_sync_point kIrtMGLSignalSyncPoint = { |
| MGLSignalSyncPoint, |
| }; |
| +int not_pnacl_filter(void) { |
|
Mark Seaborn
2015/10/27 17:30:20
Naming nit: NotPNaClFilter().
Also can use "()" i
Sean Klein
2015/10/28 17:02:41
Done.
|
| + if (g_running_translator) { |
|
Mark Seaborn
2015/10/27 17:30:20
Just "return g_running_translator"?
Sean Klein
2015/10/28 17:02:40
Done.
|
| + return 1; |
| + } |
| + return 0; |
| +} |
| + |
| const struct nacl_irt_interface kIrtInterfaces[] = { |
| - {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}, |
| + // Interface to call Mojo functions |
| + { NACL_IRT_MOJO_v0_1, |
| + &kIrtMojo, |
| + sizeof(kIrtMojo), |
| + nullptr }, |
| + // Interface to call PNaCl translation |
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1, |
| + &nacl::nacl_irt_private_pnacl_translator_compile, |
| + sizeof(nacl_irt_private_pnacl_translator_compile), |
| + not_pnacl_filter }, |
| + // Interface to call PNaCl linking |
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1, |
| + &nacl::nacl_irt_private_pnacl_translator_link, |
| + sizeof(nacl_irt_private_pnacl_translator_link), |
| + not_pnacl_filter }, |
| + // Adds mechanism for opening object files, like crtbegin.o |
| + { NACL_IRT_RESOURCE_OPEN_v0_1, |
| + &nacl::nacl_irt_resource_open, |
| + sizeof(nacl_irt_resource_open), |
| + not_pnacl_filter }, |
| {NACL_IRT_MGL_v0_1, &kIrtMGL, sizeof(kIrtMGL), nullptr}, |
| {NACL_IRT_MGL_ONSCREEN_v0_1, &kIrtMGLOnScreen, sizeof(kIrtMGLOnScreen), |
| nullptr}, |
|
Petr Hosek
2015/10/27 15:07:52
Could you reformat all items to be consistent?
Sean Klein
2015/10/28 17:02:40
Done. Also, added comments for GPU-related IRT int
|
| @@ -70,10 +93,19 @@ const struct nacl_irt_interface kIrtInterfaces[] = { |
| namespace nacl { |
| +MojoResult MojoGetInitialHandle(MojoHandle* handle) { |
| + *handle = g_mojo_handle; |
| + return MOJO_RESULT_OK; |
| +} |
| + |
| void MojoSetInitialHandle(MojoHandle handle) { |
| g_mojo_handle = handle; |
| } |
| +void MojoPnaclTranslatorEnable() { |
| + g_running_translator = true; |
| +} |
| + |
| size_t MojoIrtNonsfiQuery(const char* interface_ident, |
| void* table, |
| size_t tablesize) { |