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" | |
39 | 38 |
40 #if defined(OS_POSIX) | 39 #if defined(OS_POSIX) |
41 #include "base/file_descriptor_posix.h" | 40 #include "base/file_descriptor_posix.h" |
42 #endif | 41 #endif |
43 | 42 |
44 #if defined(OS_LINUX) | 43 #if defined(OS_LINUX) |
45 #include "content/public/common/child_process_sandbox_support_linux.h" | 44 #include "content/public/common/child_process_sandbox_support_linux.h" |
46 #endif | 45 #endif |
47 | 46 |
48 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 params.nexe_file); | 426 params.nexe_file); |
428 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); | 427 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); |
429 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, | 428 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, |
430 file_path_str.c_str()); | 429 file_path_str.c_str()); |
431 | 430 |
432 #if defined(OS_POSIX) | 431 #if defined(OS_POSIX) |
433 if (params.enable_mojo) { | 432 if (params.enable_mojo) { |
434 #if !defined(OS_MACOSX) | 433 #if !defined(OS_MACOSX) |
435 // Don't call mojo::embedder::Init on Mac; it's already been called from | 434 // Don't call mojo::embedder::Init on Mac; it's already been called from |
436 // ChromeMain() (see chrome/app/chrome_exe_main_mac.cc). | 435 // ChromeMain() (see chrome/app/chrome_exe_main_mac.cc). |
437 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( | 436 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>()); |
438 new mojo::embedder::SimplePlatformSupport())); | |
439 #endif | 437 #endif |
440 // InjectMojo adds a file descriptor to the process that allows Mojo calls | 438 // InjectMojo adds a file descriptor to the process that allows Mojo calls |
441 // to use an implementation defined outside the NaCl sandbox. See | 439 // to use an implementation defined outside the NaCl sandbox. See |
442 // //mojo/nacl for implementation details. | 440 // //mojo/nacl for implementation details. |
443 InjectMojo(nap); | 441 InjectMojo(nap); |
444 } else { | 442 } else { |
445 // When Mojo isn't enabled, we inject a file descriptor that intentionally | 443 // When Mojo isn't enabled, we inject a file descriptor that intentionally |
446 // fails on any imc_sendmsg() call to make debugging easier. | 444 // fails on any imc_sendmsg() call to make debugging easier. |
447 InjectDisabledMojo(nap); | 445 InjectDisabledMojo(nap); |
448 } | 446 } |
(...skipping 22 matching lines...) Expand all Loading... |
471 } | 469 } |
472 | 470 |
473 void NaClListener::OnFileTokenResolved( | 471 void NaClListener::OnFileTokenResolved( |
474 uint64_t token_lo, | 472 uint64_t token_lo, |
475 uint64_t token_hi, | 473 uint64_t token_hi, |
476 IPC::PlatformFileForTransit ipc_fd, | 474 IPC::PlatformFileForTransit ipc_fd, |
477 base::FilePath file_path) { | 475 base::FilePath file_path) { |
478 resolved_cb_.Run(ipc_fd, file_path); | 476 resolved_cb_.Run(ipc_fd, file_path); |
479 resolved_cb_.Reset(); | 477 resolved_cb_.Reset(); |
480 } | 478 } |
OLD | NEW |