Chromium Code Reviews| Index: components/nacl/loader/nacl_listener.cc |
| diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc |
| index 427dd8c1584ad486c4084714cd69d8ba8faa7361..f7e4d6ad930dbd07dcafe443099e84968d1cd9a0 100644 |
| --- a/components/nacl/loader/nacl_listener.cc |
| +++ b/components/nacl/loader/nacl_listener.cc |
| @@ -5,6 +5,7 @@ |
| #include "components/nacl/loader/nacl_listener.h" |
| #include <errno.h> |
| +#include <fcntl.h> |
| #include <stdlib.h> |
| #if defined(OS_POSIX) |
| @@ -27,6 +28,7 @@ |
| #include "native_client/src/public/chrome_main.h" |
| #include "native_client/src/public/nacl_app.h" |
| #include "native_client/src/public/nacl_file_info.h" |
| +#include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
| #if defined(OS_POSIX) |
| #include "base/file_descriptor_posix.h" |
| @@ -37,7 +39,6 @@ |
| #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
| #include "content/public/common/child_process_sandbox_support_linux.h" |
| #include "native_client/src/trusted/desc/nacl_desc_io.h" |
| -#include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
| #include "ppapi/nacl_irt/plugin_startup.h" |
| #endif |
| @@ -390,6 +391,24 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { |
| args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| #endif |
| + NaClFileInfo nexe_file_info; |
| + base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( |
| + params.nexe_file); |
| +#if defined(OS_WIN) |
| + nexe_file_info.desc = |
| + _open_osfhandle(reinterpret_cast<intptr_t>(nexe_file), |
| + _O_RDONLY | _O_BINARY); |
| +#elif defined(OS_POSIX) |
| + nexe_file_info.desc = nexe_file; |
| +#else |
| +#error Unsupported target platform. |
| +#endif |
| + // TODO(teravest): Resolve the file tokens right now in the browser process |
|
Mark Seaborn
2014/07/02 23:48:36
Nit: "right now in the browser process" is out of
teravest
2014/07/07 22:48:48
Done.
|
| + // instead of making the loader send IPC to resolve them later. |
| + nexe_file_info.file_token.lo = params.nexe_token_lo; |
| + nexe_file_info.file_token.hi = params.nexe_token_hi; |
| + args->nexe_desc = NaClDescIoFromFileInfo(nexe_file_info, NACL_ABI_O_RDONLY); |
| + |
| NaClChromeMainStartApp(nap, args); |
|
Mark Seaborn
2014/07/01 20:32:48
Since you're not switching to using NaClChromeMain
|
| NOTREACHED(); |
| } |
| @@ -473,6 +492,8 @@ void NaClListener::StartNonSfi(const nacl::NaClStartParams& params) { |
| CHECK(params.handles.empty()); |
| CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); |
| + CHECK(params.nexe_token_lo == 0); |
| + CHECK(params.nexe_token_hi == 0); |
| nacl::nonsfi::MainStart( |
| NaClDescIoDescFromDescAllocCtor( |
| IPC::PlatformFileForTransitToPlatformFile(params.nexe_file), |