| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 #if defined(OS_LINUX) | 421 #if defined(OS_LINUX) |
| 422 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 422 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| 423 #endif | 423 #endif |
| 424 | 424 |
| 425 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( | 425 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( |
| 426 params.nexe_file); | 426 params.nexe_file); |
| 427 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); | 427 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); |
| 428 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, | 428 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, |
| 429 file_path_str.c_str()); | 429 file_path_str.c_str()); |
| 430 | 430 |
| 431 #if defined(OS_POSIX) |
| 431 if (params.enable_mojo) { | 432 if (params.enable_mojo) { |
| 433 #if !defined(OS_MACOSX) |
| 434 // 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 mojo::embedder::Init(make_scoped_ptr( |
| 437 new mojo::embedder::SimplePlatformSupport())); |
| 438 #endif |
| 432 // InjectMojo adds a file descriptor to the process that allows Mojo calls | 439 // InjectMojo adds a file descriptor to the process that allows Mojo calls |
| 433 // to use an implementation defined outside the NaCl sandbox. See | 440 // to use an implementation defined outside the NaCl sandbox. See |
| 434 // //mojo/nacl for implementation details. | 441 // //mojo/nacl for implementation details. |
| 435 InjectMojo(nap); | 442 InjectMojo(nap); |
| 436 } else { | 443 } else { |
| 437 // When Mojo isn't enabled, we inject a file descriptor that intentionally | 444 // When Mojo isn't enabled, we inject a file descriptor that intentionally |
| 438 // fails on any imc_sendmsg() call to make debugging easier. | 445 // fails on any imc_sendmsg() call to make debugging easier. |
| 439 InjectDisabledMojo(nap); | 446 InjectDisabledMojo(nap); |
| 440 } | 447 } |
| 448 #else |
| 449 InjectDisabledMojo(nap); |
| 450 #endif |
| 441 // TODO(yusukes): Support pre-opening resource files. | 451 // TODO(yusukes): Support pre-opening resource files. |
| 442 CHECK(params.prefetched_resource_files.empty()); | 452 CHECK(params.prefetched_resource_files.empty()); |
| 443 | 453 |
| 444 int exit_status; | 454 int exit_status; |
| 445 if (!NaClChromeMainStart(nap, args, &exit_status)) | 455 if (!NaClChromeMainStart(nap, args, &exit_status)) |
| 446 NaClExit(1); | 456 NaClExit(1); |
| 447 | 457 |
| 448 // Report the plugin's exit status if the application started successfully. | 458 // Report the plugin's exit status if the application started successfully. |
| 449 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); | 459 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); |
| 450 NaClExit(exit_status); | 460 NaClExit(exit_status); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 462 } | 472 } |
| 463 | 473 |
| 464 void NaClListener::OnFileTokenResolved( | 474 void NaClListener::OnFileTokenResolved( |
| 465 uint64_t token_lo, | 475 uint64_t token_lo, |
| 466 uint64_t token_hi, | 476 uint64_t token_hi, |
| 467 IPC::PlatformFileForTransit ipc_fd, | 477 IPC::PlatformFileForTransit ipc_fd, |
| 468 base::FilePath file_path) { | 478 base::FilePath file_path) { |
| 469 resolved_cb_.Run(ipc_fd, file_path); | 479 resolved_cb_.Run(ipc_fd, file_path); |
| 470 resolved_cb_.Reset(); | 480 resolved_cb_.Reset(); |
| 471 } | 481 } |
| OLD | NEW |