 Chromium Code Reviews
 Chromium Code Reviews Issue 1382713002:
  Creating a pexe content handler to translate and run pexes.  (Closed) 
  Base URL: https://github.com/domokit/mojo.git@master
    
  
    Issue 1382713002:
  Creating a pexe content handler to translate and run pexes.  (Closed) 
  Base URL: https://github.com/domokit/mojo.git@master| 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 a63189b6c6484454d03e133895b772d4e0f67012..6fb27f6b8a59ebefef76c92d80ac6e29385eb64d 100644 | 
| --- a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc | 
| +++ b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc | 
| @@ -7,16 +7,12 @@ | 
| #include "mojo/public/c/system/functions.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; | 
| -} | 
| - | 
| const struct nacl_irt_mojo kIrtMojo = { | 
| MojoCreateSharedBuffer, | 
| MojoDuplicateBufferHandle, | 
| @@ -36,16 +32,41 @@ const struct nacl_irt_mojo kIrtMojo = { | 
| MojoCreateMessagePipe, | 
| MojoWriteMessage, | 
| MojoReadMessage, | 
| - _MojoGetInitialHandle, | 
| + nacl::_MojoGetInitialHandle, | 
| }; | 
| -const struct nacl_irt_interface kIrtInterfaces[] = { | 
| - {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr}}; | 
| +static const struct nacl_irt_interface kIrtInterfaces[] = { | 
| 
Mark Seaborn
2015/10/20 21:32:40
Nit: 'static' not needed: this is in an anon names
 
Sean Klein
2015/10/22 21:50:00
Done.
 | 
| + /* Interface to call Mojo functions */ | 
| 
Mark Seaborn
2015/10/20 21:32:40
Nit: Use C++-style comments
 
Sean Klein
2015/10/22 21:50:00
Done.
 | 
| + { NACL_IRT_MOJO_v0_1, | 
| + &kIrtMojo, | 
| + sizeof(kIrtMojo), | 
| + nullptr }, | 
| + /* Interface to call PNaCl translation */ | 
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1, | 
| + &nacl_irt_private_pnacl_translator_compile, | 
| + sizeof(nacl_irt_private_pnacl_translator_compile), | 
| + nullptr }, | 
| 
Mark Seaborn
2015/10/20 22:28:58
Can you conditionalise the 3 new interfaces so tha
 
Sean Klein
2015/10/22 21:50:00
Done.
 | 
| + /* Interface to call PNaCl linking */ | 
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1, | 
| + &nacl_irt_private_pnacl_translator_link, | 
| + sizeof(nacl_irt_private_pnacl_translator_link), | 
| + nullptr }, | 
| + /* Adds mechanism for opening object files, like crtbegin.o */ | 
| + { NACL_IRT_RESOURCE_OPEN_v0_1, | 
| + &nacl_irt_resource_open, | 
| + sizeof(nacl_irt_resource_open), | 
| + nullptr }, | 
| +}; | 
| } // namespace | 
| namespace nacl { | 
| +MojoResult _MojoGetInitialHandle(MojoHandle* handle) { | 
| + *handle = g_mojo_handle; | 
| + return MOJO_RESULT_OK; | 
| +} | 
| + | 
| void MojoSetInitialHandle(MojoHandle handle) { | 
| g_mojo_handle = handle; | 
| } |