| 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 _O_RDONLY | _O_BINARY); | 463 _O_RDONLY | _O_BINARY); |
| 464 #elif defined(OS_POSIX) | 464 #elif defined(OS_POSIX) |
| 465 nexe_file_info.desc = nexe_file; | 465 nexe_file_info.desc = nexe_file; |
| 466 #else | 466 #else |
| 467 #error Unsupported target platform. | 467 #error Unsupported target platform. |
| 468 #endif | 468 #endif |
| 469 nexe_file_info.file_token.lo = params.nexe_token_lo; | 469 nexe_file_info.file_token.lo = params.nexe_token_lo; |
| 470 nexe_file_info.file_token.hi = params.nexe_token_hi; | 470 nexe_file_info.file_token.hi = params.nexe_token_hi; |
| 471 args->nexe_desc = NaClDescIoFromFileInfo(nexe_file_info, NACL_ABI_O_RDONLY); | 471 args->nexe_desc = NaClDescIoFromFileInfo(nexe_file_info, NACL_ABI_O_RDONLY); |
| 472 | 472 |
| 473 // TODO(yusukes): Support pre-opening resource files. |
| 474 CHECK(params.resource_files.empty()); |
| 475 |
| 473 int exit_status; | 476 int exit_status; |
| 474 if (!NaClChromeMainStart(nap, args, &exit_status)) | 477 if (!NaClChromeMainStart(nap, args, &exit_status)) |
| 475 NaClExit(1); | 478 NaClExit(1); |
| 476 | 479 |
| 477 // Report the plugin's exit status if the application started successfully. | 480 // Report the plugin's exit status if the application started successfully. |
| 478 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); | 481 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); |
| 479 NaClExit(exit_status); | 482 NaClExit(exit_status); |
| 480 } | 483 } |
| 481 | 484 |
| 482 void NaClListener::ResolveFileToken( | 485 void NaClListener::ResolveFileToken( |
| 483 uint64_t token_lo, | 486 uint64_t token_lo, |
| 484 uint64_t token_hi, | 487 uint64_t token_hi, |
| 485 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { | 488 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { |
| 486 if (!Send(new NaClProcessMsg_ResolveFileTokenAsync(token_lo, token_hi))) { | 489 if (!Send(new NaClProcessMsg_ResolveFileTokenAsync(token_lo, token_hi))) { |
| 487 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); | 490 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); |
| 488 return; | 491 return; |
| 489 } | 492 } |
| 490 resolved_cb_ = cb; | 493 resolved_cb_ = cb; |
| 491 } | 494 } |
| 492 | 495 |
| 493 void NaClListener::OnFileTokenResolved( | 496 void NaClListener::OnFileTokenResolved( |
| 494 uint64_t token_lo, | 497 uint64_t token_lo, |
| 495 uint64_t token_hi, | 498 uint64_t token_hi, |
| 496 IPC::PlatformFileForTransit ipc_fd, | 499 IPC::PlatformFileForTransit ipc_fd, |
| 497 base::FilePath file_path) { | 500 base::FilePath file_path) { |
| 498 resolved_cb_.Run(ipc_fd, file_path); | 501 resolved_cb_.Run(ipc_fd, file_path); |
| 499 resolved_cb_.Reset(); | 502 resolved_cb_.Reset(); |
| 500 } | 503 } |
| OLD | NEW |