| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 #if defined(OS_LINUX) | 417 #if defined(OS_LINUX) |
| 418 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 418 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| 419 #endif | 419 #endif |
| 420 | 420 |
| 421 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( | 421 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile( |
| 422 params.nexe_file); | 422 params.nexe_file); |
| 423 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); | 423 std::string file_path_str = params.nexe_file_path_metadata.AsUTF8Unsafe(); |
| 424 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, | 424 args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, |
| 425 file_path_str.c_str()); | 425 file_path_str.c_str()); |
| 426 | 426 |
| 427 // TODO(yusukes): Support pre-opening resource files. |
| 428 CHECK(params.resource_files.empty()); |
| 429 CHECK(params.resource_keys.empty()); |
| 430 |
| 427 int exit_status; | 431 int exit_status; |
| 428 if (!NaClChromeMainStart(nap, args, &exit_status)) | 432 if (!NaClChromeMainStart(nap, args, &exit_status)) |
| 429 NaClExit(1); | 433 NaClExit(1); |
| 430 | 434 |
| 431 // Report the plugin's exit status if the application started successfully. | 435 // Report the plugin's exit status if the application started successfully. |
| 432 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); | 436 trusted_listener_->Send(new NaClRendererMsg_ReportExitStatus(exit_status)); |
| 433 NaClExit(exit_status); | 437 NaClExit(exit_status); |
| 434 } | 438 } |
| 435 | 439 |
| 436 void NaClListener::ResolveFileToken( | 440 void NaClListener::ResolveFileToken( |
| 437 uint64_t token_lo, | 441 uint64_t token_lo, |
| 438 uint64_t token_hi, | 442 uint64_t token_hi, |
| 439 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { | 443 base::Callback<void(IPC::PlatformFileForTransit, base::FilePath)> cb) { |
| 440 if (!Send(new NaClProcessMsg_ResolveFileToken(token_lo, token_hi))) { | 444 if (!Send(new NaClProcessMsg_ResolveFileToken(token_lo, token_hi))) { |
| 441 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); | 445 cb.Run(IPC::PlatformFileForTransit(), base::FilePath()); |
| 442 return; | 446 return; |
| 443 } | 447 } |
| 444 resolved_cb_ = cb; | 448 resolved_cb_ = cb; |
| 445 } | 449 } |
| 446 | 450 |
| 447 void NaClListener::OnFileTokenResolved( | 451 void NaClListener::OnFileTokenResolved( |
| 448 uint64_t token_lo, | 452 uint64_t token_lo, |
| 449 uint64_t token_hi, | 453 uint64_t token_hi, |
| 450 IPC::PlatformFileForTransit ipc_fd, | 454 IPC::PlatformFileForTransit ipc_fd, |
| 451 base::FilePath file_path) { | 455 base::FilePath file_path) { |
| 452 resolved_cb_.Run(ipc_fd, file_path); | 456 resolved_cb_.Run(ipc_fd, file_path); |
| 453 resolved_cb_.Reset(); | 457 resolved_cb_.Reset(); |
| 454 } | 458 } |
| OLD | NEW |