Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_listener.h" | 5 #include "components/nacl/loader/nacl_listener.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "ipc/ipc_switches.h" | 28 #include "ipc/ipc_switches.h" |
| 29 #include "ipc/ipc_sync_channel.h" | 29 #include "ipc/ipc_sync_channel.h" |
| 30 #include "ipc/ipc_sync_message_filter.h" | 30 #include "ipc/ipc_sync_message_filter.h" |
| 31 #include "mojo/nacl/mojo_syscall.h" | 31 #include "mojo/nacl/mojo_syscall.h" |
| 32 #include "native_client/src/public/chrome_main.h" | 32 #include "native_client/src/public/chrome_main.h" |
| 33 #include "native_client/src/public/nacl_app.h" | 33 #include "native_client/src/public/nacl_app.h" |
| 34 #include "native_client/src/public/nacl_desc.h" | 34 #include "native_client/src/public/nacl_desc.h" |
| 35 #include "native_client/src/public/nacl_file_info.h" | 35 #include "native_client/src/public/nacl_file_info.h" |
| 36 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 36 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 37 #include "third_party/mojo/src/mojo/edk/embedder/platform_support.h" | 37 #include "third_party/mojo/src/mojo/edk/embedder/platform_support.h" |
| 38 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" | |
| 38 | 39 |
| 39 #if defined(OS_POSIX) | 40 #if defined(OS_POSIX) |
| 40 #include "base/file_descriptor_posix.h" | 41 #include "base/file_descriptor_posix.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 #if defined(OS_LINUX) | 44 #if defined(OS_LINUX) |
| 44 #include "content/public/common/child_process_sandbox_support_linux.h" | 45 #include "content/public/common/child_process_sandbox_support_linux.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 params.nexe_file); | 427 params.nexe_file); |
| 427 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); | 428 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); |
| 428 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, | 429 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, |
| 429 file_path_str.c_str()); | 430 file_path_str.c_str()); |
| 430 | 431 |
| 431 #if defined(OS_POSIX) | 432 #if defined(OS_POSIX) |
| 432 if (params.enable_mojo) { | 433 if (params.enable_mojo) { |
| 433 #if !defined(OS_MACOSX) | 434 #if !defined(OS_MACOSX) |
| 434 // Don't call mojo::embedder::Init on Mac; it's already been called from | 435 // Don't call mojo::embedder::Init on Mac; it's already been called from |
| 435 // ChromeMain() (see chrome/app/chrome_exe_main_mac.cc). | 436 // ChromeMain() (see chrome/app/chrome_exe_main_mac.cc). |
| 436 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>()); | 437 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( |
|
jamesr
2015/02/06 22:31:38
nit: you can just say make_scoped_ptr(new mojo::..
viettrungluu
2015/02/07 00:14:31
Done.
| |
| 438 new mojo::embedder::SimplePlatformSupport())); | |
| 437 #endif | 439 #endif |
| 438 // InjectMojo adds a file descriptor to the process that allows Mojo calls | 440 // InjectMojo adds a file descriptor to the process that allows Mojo calls |
| 439 // to use an implementation defined outside the NaCl sandbox. See | 441 // to use an implementation defined outside the NaCl sandbox. See |
| 440 // //mojo/nacl for implementation details. | 442 // //mojo/nacl for implementation details. |
| 441 InjectMojo(nap); | 443 InjectMojo(nap); |
| 442 } else { | 444 } else { |
| 443 // When Mojo isn't enabled, we inject a file descriptor that intentionally | 445 // When Mojo isn't enabled, we inject a file descriptor that intentionally |
| 444 // fails on any imc_sendmsg() call to make debugging easier. | 446 // fails on any imc_sendmsg() call to make debugging easier. |
| 445 InjectDisabledMojo(nap); | 447 InjectDisabledMojo(nap); |
| 446 } | 448 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 469 } | 471 } |
| 470 | 472 |
| 471 void NaClListener::OnFileTokenResolved( | 473 void NaClListener::OnFileTokenResolved( |
| 472 uint64_t token_lo, | 474 uint64_t token_lo, |
| 473 uint64_t token_hi, | 475 uint64_t token_hi, |
| 474 IPC::PlatformFileForTransit ipc_fd, | 476 IPC::PlatformFileForTransit ipc_fd, |
| 475 base::FilePath file_path) { | 477 base::FilePath file_path) { |
| 476 resolved_cb_.Run(ipc_fd, file_path); | 478 resolved_cb_.Run(ipc_fd, file_path); |
| 477 resolved_cb_.Reset(); | 479 resolved_cb_.Reset(); |
| 478 } | 480 } |
| OLD | NEW |