| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // //mojo/nacl for implementation details. | 441 // //mojo/nacl for implementation details. |
| 442 InjectMojo(nap); | 442 InjectMojo(nap); |
| 443 } else { | 443 } else { |
| 444 // 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 |
| 445 // fails on any imc_sendmsg() call to make debugging easier. | 445 // fails on any imc_sendmsg() call to make debugging easier. |
| 446 InjectDisabledMojo(nap); | 446 InjectDisabledMojo(nap); |
| 447 } | 447 } |
| 448 #else | 448 #else |
| 449 InjectDisabledMojo(nap); | 449 InjectDisabledMojo(nap); |
| 450 #endif | 450 #endif |
| 451 // TODO(yusukes): Support pre-opening resource files. |
| 452 CHECK(params.prefetched_resource_files.empty()); |
| 451 | 453 |
| 452 int exit_status; | 454 int exit_status; |
| 453 if (!NaClChromeMainStart(nap, args, &exit_status)) | 455 if (!NaClChromeMainStart(nap, args, &exit_status)) |
| 454 NaClExit(1); | 456 NaClExit(1); |
| 455 | 457 |
| 456 // Report the plugin's exit status if the application started successfully. | 458 // Report the plugin's exit status if the application started successfully. |
| 457 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); | 459 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); |
| 458 NaClExit(exit_status); | 460 NaClExit(exit_status); |
| 459 } | 461 } |
| 460 | 462 |
| 461 void NaClListener::ResolveFileToken( | 463 void NaClListener::ResolveFileToken( |
| 462 uint64_t token_lo, | 464 uint64_t token_lo, |
| 463 uint64_t token_hi, | 465 uint64_t token_hi, |
| 464 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { | 466 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { |
| 465 if (!Send(new NaClProcessMsg_ResolveFileToken(token_lo, token_hi))) { | 467 if (!Send(new NaClProcessMsg_ResolveFileToken(token_lo, token_hi))) { |
| 466 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); | 468 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); |
| 467 return; | 469 return; |
| 468 } | 470 } |
| 469 resolved_cb_ = cb; | 471 resolved_cb_ = cb; |
| 470 } | 472 } |
| 471 | 473 |
| 472 void NaClListener::OnFileTokenResolved( | 474 void NaClListener::OnFileTokenResolved( |
| 473 uint64_t token_lo, | 475 uint64_t token_lo, |
| 474 uint64_t token_hi, | 476 uint64_t token_hi, |
| 475 IPC::PlatformFileForTransit ipc_fd, | 477 IPC::PlatformFileForTransit ipc_fd, |
| 476 base::FilePath file_path) { | 478 base::FilePath file_path) { |
| 477 resolved_cb_.Run(ipc_fd, file_path); | 479 resolved_cb_.Run(ipc_fd, file_path); |
| 478 resolved_cb_.Reset(); | 480 resolved_cb_.Reset(); |
| 479 } | 481 } |
| OLD | NEW |