| 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 "native_client/src/trusted/plugin/pnacl_translate_thread.h" | 5 #include "native_client/src/trusted/plugin/pnacl_translate_thread.h" |
| 6 | 6 |
| 7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 8 #include "native_client/src/trusted/plugin/plugin.h" | 8 #include "native_client/src/trusted/plugin/plugin.h" |
| 9 #include "native_client/src/trusted/plugin/plugin_error.h" | 9 #include "native_client/src/trusted/plugin/plugin_error.h" |
| 10 #include "native_client/src/trusted/plugin/pnacl_resources.h" | 10 #include "native_client/src/trusted/plugin/pnacl_resources.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 void PnaclTranslateThread::DoTranslate() { | 129 void PnaclTranslateThread::DoTranslate() { |
| 130 ErrorInfo error_info; | 130 ErrorInfo error_info; |
| 131 SrpcParams params; | 131 SrpcParams params; |
| 132 nacl::DescWrapper* llc_out_file = obj_file_->write_wrapper(); | 132 nacl::DescWrapper* llc_out_file = obj_file_->write_wrapper(); |
| 133 | 133 |
| 134 { | 134 { |
| 135 nacl::MutexLocker ml(&subprocess_mu_); | 135 nacl::MutexLocker ml(&subprocess_mu_); |
| 136 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds(); | 136 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds(); |
| 137 llc_subprocess_.reset( | 137 llc_subprocess_.reset( |
| 138 StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_, &error_info)); | 138 StartSubprocess(resources_->GetLlcUrl(), manifest_, &error_info)); |
| 139 if (llc_subprocess_ == NULL) { | 139 if (llc_subprocess_ == NULL) { |
| 140 TranslateFailed(ERROR_PNACL_LLC_SETUP, | 140 TranslateFailed(ERROR_PNACL_LLC_SETUP, |
| 141 "Compile process could not be created: " + | 141 "Compile process could not be created: " + |
| 142 error_info.message()); | 142 error_info.message()); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 llc_subprocess_active_ = true; | 145 llc_subprocess_active_ = true; |
| 146 time_stats_.pnacl_llc_load_time = | 146 time_stats_.pnacl_llc_load_time = |
| 147 (NaClGetTimeOfDayMicroseconds() - llc_start_time); | 147 (NaClGetTimeOfDayMicroseconds() - llc_start_time); |
| 148 // Run LLC. | 148 // Run LLC. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return false; | 271 return false; |
| 272 } | 272 } |
| 273 nacl::DescWrapper* ld_in_file = obj_file_->read_wrapper(); | 273 nacl::DescWrapper* ld_in_file = obj_file_->read_wrapper(); |
| 274 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); | 274 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); |
| 275 | 275 |
| 276 { | 276 { |
| 277 // Create LD process | 277 // Create LD process |
| 278 nacl::MutexLocker ml(&subprocess_mu_); | 278 nacl::MutexLocker ml(&subprocess_mu_); |
| 279 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds(); | 279 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds(); |
| 280 ld_subprocess_.reset( | 280 ld_subprocess_.reset( |
| 281 StartSubprocess(PnaclUrls::GetLdUrl(), manifest_, &error_info)); | 281 StartSubprocess(resources_->GetLdUrl(), manifest_, &error_info)); |
| 282 if (ld_subprocess_ == NULL) { | 282 if (ld_subprocess_ == NULL) { |
| 283 TranslateFailed(ERROR_PNACL_LD_SETUP, | 283 TranslateFailed(ERROR_PNACL_LD_SETUP, |
| 284 "Link process could not be created: " + | 284 "Link process could not be created: " + |
| 285 error_info.message()); | 285 error_info.message()); |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 ld_subprocess_active_ = true; | 288 ld_subprocess_active_ = true; |
| 289 time_stats_.pnacl_ld_load_time = | 289 time_stats_.pnacl_ld_load_time = |
| 290 (NaClGetTimeOfDayMicroseconds() - ld_start_time); | 290 (NaClGetTimeOfDayMicroseconds() - ld_start_time); |
| 291 PluginReverseInterface* ld_reverse = | 291 PluginReverseInterface* ld_reverse = |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 PLUGIN_PRINTF(("~PnaclTranslateThread (translate_thread=%p)\n", this)); | 358 PLUGIN_PRINTF(("~PnaclTranslateThread (translate_thread=%p)\n", this)); |
| 359 AbortSubprocesses(); | 359 AbortSubprocesses(); |
| 360 NaClThreadJoin(translate_thread_.get()); | 360 NaClThreadJoin(translate_thread_.get()); |
| 361 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); | 361 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); |
| 362 NaClCondVarDtor(&buffer_cond_); | 362 NaClCondVarDtor(&buffer_cond_); |
| 363 NaClMutexDtor(&cond_mu_); | 363 NaClMutexDtor(&cond_mu_); |
| 364 NaClMutexDtor(&subprocess_mu_); | 364 NaClMutexDtor(&subprocess_mu_); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace plugin | 367 } // namespace plugin |
| OLD | NEW |