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