| 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 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h" | 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 SrpcParams params; | 155 SrpcParams params; |
| 156 std::vector<nacl::DescWrapper*> llc_out_files; | 156 std::vector<nacl::DescWrapper*> llc_out_files; |
| 157 size_t i; | 157 size_t i; |
| 158 for (i = 0; i < obj_files_->size(); i++) | 158 for (i = 0; i < obj_files_->size(); i++) |
| 159 llc_out_files.push_back((*obj_files_)[i]->write_wrapper()); | 159 llc_out_files.push_back((*obj_files_)[i]->write_wrapper()); |
| 160 for (; i < PnaclCoordinator::kMaxTranslatorObjectFiles; i++) | 160 for (; i < PnaclCoordinator::kMaxTranslatorObjectFiles; i++) |
| 161 llc_out_files.push_back(invalid_desc_wrapper_); | 161 llc_out_files.push_back(invalid_desc_wrapper_); |
| 162 | 162 |
| 163 pp::Core* core = pp::Module::Get()->core(); | 163 pp::Core* core = pp::Module::Get()->core(); |
| 164 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds(); | 164 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds(); |
| 165 PP_FileHandle llc_file_handle = resources_->TakeLlcFileHandle(); | 165 PP_NaClFileInfo llc_file_info = resources_->TakeLlcFileInfo(); |
| 166 // On success, ownership of llc_file_handle is transferred. | 166 // On success, ownership of llc_file_info is transferred. |
| 167 NaClSubprocess* llc_subprocess = plugin_->LoadHelperNaClModule( | 167 NaClSubprocess* llc_subprocess = plugin_->LoadHelperNaClModule( |
| 168 resources_->GetLlcUrl(), llc_file_handle, &error_info); | 168 resources_->GetLlcUrl(), llc_file_info, &error_info); |
| 169 if (llc_subprocess == NULL) { | 169 if (llc_subprocess == NULL) { |
| 170 if (llc_file_handle != PP_kInvalidFileHandle) | 170 if (llc_file_info.handle != PP_kInvalidFileHandle) |
| 171 CloseFileHandle(llc_file_handle); | 171 CloseFileHandle(llc_file_info.handle); |
| 172 TranslateFailed(PP_NACL_ERROR_PNACL_LLC_SETUP, | 172 TranslateFailed(PP_NACL_ERROR_PNACL_LLC_SETUP, |
| 173 "Compile process could not be created: " + | 173 "Compile process could not be created: " + |
| 174 error_info.message()); | 174 error_info.message()); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 GetNaClInterface()->LogTranslateTime( | 177 GetNaClInterface()->LogTranslateTime( |
| 178 "NaCl.Perf.PNaClLoadTime.LoadCompiler", | 178 "NaCl.Perf.PNaClLoadTime.LoadCompiler", |
| 179 NaClGetTimeOfDayMicroseconds() - llc_start_time); | 179 NaClGetTimeOfDayMicroseconds() - llc_start_time); |
| 180 | 180 |
| 181 { | 181 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 "Link process could not reset object file"); | 327 "Link process could not reset object file"); |
| 328 return false; | 328 return false; |
| 329 } | 329 } |
| 330 ld_in_files.push_back((*obj_files_)[i]->read_wrapper()); | 330 ld_in_files.push_back((*obj_files_)[i]->read_wrapper()); |
| 331 } | 331 } |
| 332 for (; i < PnaclCoordinator::kMaxTranslatorObjectFiles; i++) | 332 for (; i < PnaclCoordinator::kMaxTranslatorObjectFiles; i++) |
| 333 ld_in_files.push_back(invalid_desc_wrapper_); | 333 ld_in_files.push_back(invalid_desc_wrapper_); |
| 334 | 334 |
| 335 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); | 335 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); |
| 336 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds(); | 336 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds(); |
| 337 PP_FileHandle ld_file_handle = resources_->TakeLdFileHandle(); | 337 PP_NaClFileInfo ld_file_info = resources_->TakeLdFileInfo(); |
| 338 // On success, ownership of ld_file_handle is transferred. | 338 // On success, ownership of ld_file_info is transferred. |
| 339 nacl::scoped_ptr<NaClSubprocess> ld_subprocess( | 339 nacl::scoped_ptr<NaClSubprocess> ld_subprocess( |
| 340 plugin_->LoadHelperNaClModule(resources_->GetLlcUrl(), | 340 plugin_->LoadHelperNaClModule(resources_->GetLlcUrl(), |
| 341 ld_file_handle, | 341 ld_file_info, |
| 342 &error_info)); | 342 &error_info)); |
| 343 if (ld_subprocess.get() == NULL) { | 343 if (ld_subprocess.get() == NULL) { |
| 344 if (ld_file_handle != PP_kInvalidFileHandle) | 344 if (ld_file_info.handle != PP_kInvalidFileHandle) |
| 345 CloseFileHandle(ld_file_handle); | 345 CloseFileHandle(ld_file_info.handle); |
| 346 TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP, | 346 TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP, |
| 347 "Link process could not be created: " + | 347 "Link process could not be created: " + |
| 348 error_info.message()); | 348 error_info.message()); |
| 349 return false; | 349 return false; |
| 350 } | 350 } |
| 351 GetNaClInterface()->LogTranslateTime( | 351 GetNaClInterface()->LogTranslateTime( |
| 352 "NaCl.Perf.PNaClLoadTime.LoadLinker", | 352 "NaCl.Perf.PNaClLoadTime.LoadLinker", |
| 353 NaClGetTimeOfDayMicroseconds() - ld_start_time); | 353 NaClGetTimeOfDayMicroseconds() - ld_start_time); |
| 354 { | 354 { |
| 355 nacl::MutexLocker ml(&subprocess_mu_); | 355 nacl::MutexLocker ml(&subprocess_mu_); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 AbortSubprocesses(); | 447 AbortSubprocesses(); |
| 448 if (translate_thread_ != NULL) | 448 if (translate_thread_ != NULL) |
| 449 NaClThreadJoin(translate_thread_.get()); | 449 NaClThreadJoin(translate_thread_.get()); |
| 450 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); | 450 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); |
| 451 NaClCondVarDtor(&buffer_cond_); | 451 NaClCondVarDtor(&buffer_cond_); |
| 452 NaClMutexDtor(&cond_mu_); | 452 NaClMutexDtor(&cond_mu_); |
| 453 NaClMutexDtor(&subprocess_mu_); | 453 NaClMutexDtor(&subprocess_mu_); |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace plugin | 456 } // namespace plugin |
| OLD | NEW |