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..9ac32b16024bc23f60b79acd02f8700356818a06 100644 |
| --- a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| +++ b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc |
| @@ -8,15 +8,13 @@ |
| #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; |
| +std::string g_base_path = ""; |
|
Mark Seaborn
2015/10/28 18:31:43
This is a non-POD initialiser. Chromium has a pol
Sean Klein
2015/10/28 21:39:59
This is interesting. Good to know! I'll be more ca
|
| const struct nacl_irt_mojo kIrtMojo = { |
| MojoCreateSharedBuffer, |
| @@ -37,7 +35,7 @@ const struct nacl_irt_mojo kIrtMojo = { |
| MojoCreateMessagePipe, |
| MojoWriteMessage, |
| MojoReadMessage, |
| - _MojoGetInitialHandle, |
| + nacl::MojoGetInitialHandle, |
| }; |
| const struct nacl_irt_mgl kIrtMGL = { |
| @@ -57,23 +55,73 @@ const struct nacl_irt_mgl_signal_sync_point kIrtMGLSignalSyncPoint = { |
| MGLSignalSyncPoint, |
| }; |
| +int NotPNaClFilter() { |
| + return g_running_translator; |
| +} |
| + |
| const struct nacl_irt_interface kIrtInterfaces[] = { |
| - {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}, |
| - {NACL_IRT_MGL_v0_1, &kIrtMGL, sizeof(kIrtMGL), nullptr}, |
| - {NACL_IRT_MGL_ONSCREEN_v0_1, &kIrtMGLOnScreen, sizeof(kIrtMGLOnScreen), |
| - nullptr}, |
| - {NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1, &kIrtMGLSignalSyncPoint, |
| - sizeof(kIrtMGLSignalSyncPoint), 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), |
| + NotPNaClFilter }, |
| + // 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), |
| + NotPNaClFilter }, |
| + // 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), |
| + NotPNaClFilter }, |
| + // GPU functions which give control over MGL context |
| + { NACL_IRT_MGL_v0_1, |
| + &kIrtMGL, |
| + sizeof(kIrtMGL), |
| + nullptr }, |
| + // GPU functions which update framebuffer with respect to the display |
| + { NACL_IRT_MGL_ONSCREEN_v0_1, |
| + &kIrtMGLOnScreen, |
| + sizeof(kIrtMGLOnScreen), |
| + nullptr }, |
| + // GPU functions to synchronize CPU and GPU services |
| + { NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1, |
| + &kIrtMGLSignalSyncPoint, |
| + sizeof(kIrtMGLSignalSyncPoint), |
| + nullptr }, |
| }; |
| } // namespace |
| 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; |
| +} |
| + |
| +void MojoSetBasePath(std::string base_path) { |
|
Mark Seaborn
2015/10/28 18:31:43
Can be "const std::string&" to avoid one copy.
Sean Klein
2015/10/28 21:39:59
Done, but this function is being removed anyway.
|
| + g_base_path = base_path; |
| +} |
| + |
| +std::string MojoGetBasePath() { |
| + return g_base_path; |
| +} |
| + |
| size_t MojoIrtNonsfiQuery(const char* interface_ident, |
| void* table, |
| size_t tablesize) { |