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