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