| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 void Plugin::BitcodeDidTranslate(int32_t pp_error) { | 477 void Plugin::BitcodeDidTranslate(int32_t pp_error) { |
| 478 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n", | 478 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n", |
| 479 pp_error)); | 479 pp_error)); |
| 480 if (pp_error != PP_OK) { | 480 if (pp_error != PP_OK) { |
| 481 // Error should have been reported by pnacl. Just return. | 481 // Error should have been reported by pnacl. Just return. |
| 482 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); | 482 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); |
| 483 return; | 483 return; |
| 484 } | 484 } |
| 485 | 485 |
| 486 // Inform JavaScript that we successfully translated the bitcode to a nexe. | 486 // Inform JavaScript that we successfully translated the bitcode to a nexe. |
| 487 nacl::scoped_ptr<nacl::DescWrapper> | 487 PP_FileHandle handle = pnacl_coordinator_->TakeTranslatedFileHandle(); |
| 488 wrapper(pnacl_coordinator_.get()->ReleaseTranslatedFD()); | 488 int32_t fd = ConvertFileDescriptor(handle, true); |
| 489 nacl::DescWrapper* wrapper = wrapper_factory()->MakeFileDesc(fd, O_RDONLY); |
| 489 LoadNaClModule( | 490 LoadNaClModule( |
| 490 wrapper.release(), | 491 wrapper, |
| 491 false, /* uses_nonsfi_mode */ | 492 false, /* uses_nonsfi_mode */ |
| 492 false, /* enable_dyncode_syscalls */ | 493 false, /* enable_dyncode_syscalls */ |
| 493 false, /* enable_exception_handling */ | 494 false, /* enable_exception_handling */ |
| 494 true, /* enable_crash_throttling */ | 495 true, /* enable_crash_throttling */ |
| 495 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation), | 496 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation), |
| 496 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); | 497 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); |
| 497 } | 498 } |
| 498 | 499 |
| 499 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { | 500 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { |
| 500 bool was_successful = LoadNaClModuleContinuationIntern(); | 501 bool was_successful = LoadNaClModuleContinuationIntern(); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 746 |
| 746 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, | 747 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, |
| 747 int exit_status) { | 748 int exit_status) { |
| 748 DCHECK(pp::Module::Get()->core()->IsMainThread()); | 749 DCHECK(pp::Module::Get()->core()->IsMainThread()); |
| 749 DCHECK(nacl_interface_); | 750 DCHECK(nacl_interface_); |
| 750 nacl_interface_->SetExitStatus(pp_instance(), exit_status); | 751 nacl_interface_->SetExitStatus(pp_instance(), exit_status); |
| 751 } | 752 } |
| 752 | 753 |
| 753 | 754 |
| 754 } // namespace plugin | 755 } // namespace plugin |
| OLD | NEW |