OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
8 #endif | 8 #endif |
9 | 9 |
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 void Plugin::BitcodeDidTranslate(int32_t pp_error) { | 478 void Plugin::BitcodeDidTranslate(int32_t pp_error) { |
479 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n", | 479 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n", |
480 pp_error)); | 480 pp_error)); |
481 if (pp_error != PP_OK) { | 481 if (pp_error != PP_OK) { |
482 // Error should have been reported by pnacl. Just return. | 482 // Error should have been reported by pnacl. Just return. |
483 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); | 483 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); |
484 return; | 484 return; |
485 } | 485 } |
486 | 486 |
487 // Inform JavaScript that we successfully translated the bitcode to a nexe. | 487 // Inform JavaScript that we successfully translated the bitcode to a nexe. |
488 nacl::scoped_ptr<nacl::DescWrapper> | 488 PP_FileHandle handle = pnacl_coordinator_->TakeTranslatedFileHandle(); |
489 wrapper(pnacl_coordinator_.get()->ReleaseTranslatedFD()); | 489 int32_t fd = ConvertFileDescriptor(handle, true); |
| 490 nacl::DescWrapper* wrapper = wrapper_factory()->MakeFileDesc(fd, O_RDONLY); |
490 LoadNaClModule( | 491 LoadNaClModule( |
491 wrapper.release(), | 492 wrapper, |
492 false, /* uses_nonsfi_mode */ | 493 false, /* uses_nonsfi_mode */ |
493 false, /* enable_dyncode_syscalls */ | 494 false, /* enable_dyncode_syscalls */ |
494 false, /* enable_exception_handling */ | 495 false, /* enable_exception_handling */ |
495 true, /* enable_crash_throttling */ | 496 true, /* enable_crash_throttling */ |
496 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation), | 497 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation), |
497 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); | 498 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); |
498 } | 499 } |
499 | 500 |
500 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { | 501 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { |
501 bool was_successful = LoadNaClModuleContinuationIntern(); | 502 bool was_successful = LoadNaClModuleContinuationIntern(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 636 |
636 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, | 637 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, |
637 int exit_status) { | 638 int exit_status) { |
638 DCHECK(pp::Module::Get()->core()->IsMainThread()); | 639 DCHECK(pp::Module::Get()->core()->IsMainThread()); |
639 DCHECK(nacl_interface_); | 640 DCHECK(nacl_interface_); |
640 nacl_interface_->SetExitStatus(pp_instance(), exit_status); | 641 nacl_interface_->SetExitStatus(pp_instance(), exit_status); |
641 } | 642 } |
642 | 643 |
643 | 644 |
644 } // namespace plugin | 645 } // namespace plugin |
OLD | NEW |