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 "components/nacl/renderer/plugin/pnacl_translate_thread.h" | 5 #include "components/nacl/renderer/plugin/pnacl_translate_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 nacl::PPBNaClPrivate::LogTranslateTime( | 273 nacl::PPBNaClPrivate::LogTranslateTime( |
274 pnacl_options_->use_subzero | 274 pnacl_options_->use_subzero |
275 ? "NaCl.Perf.PNaClLoadTime.CompileTime.Subzero" | 275 ? "NaCl.Perf.PNaClLoadTime.CompileTime.Subzero" |
276 : "NaCl.Perf.PNaClLoadTime.CompileTime.LLC", | 276 : "NaCl.Perf.PNaClLoadTime.CompileTime.LLC", |
277 compile_time_); | 277 compile_time_); |
278 | 278 |
279 // Shut down the compiler subprocess. | 279 // Shut down the compiler subprocess. |
280 { | 280 { |
281 base::AutoLock lock(subprocess_mu_); | 281 base::AutoLock lock(subprocess_mu_); |
282 compiler_subprocess_active_ = false; | 282 compiler_subprocess_active_ = false; |
283 compiler_subprocess_->Shutdown(); | |
284 } | 283 } |
285 | 284 |
286 core->CallOnMainThread(0, compile_finished_callback_, PP_OK); | 285 core->CallOnMainThread(0, compile_finished_callback_, PP_OK); |
287 } | 286 } |
288 | 287 |
289 void PnaclTranslateThread::LinkThread::Run() { | 288 void PnaclTranslateThread::LinkThread::Run() { |
290 pnacl_translate_thread_->DoLink(); | 289 pnacl_translate_thread_->DoLink(); |
291 } | 290 } |
292 | 291 |
293 void PnaclTranslateThread::DoLink() { | 292 void PnaclTranslateThread::DoLink() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 333 } |
335 | 334 |
336 nacl::PPBNaClPrivate::LogTranslateTime( | 335 nacl::PPBNaClPrivate::LogTranslateTime( |
337 "NaCl.Perf.PNaClLoadTime.LinkTime", | 336 "NaCl.Perf.PNaClLoadTime.LinkTime", |
338 (base::TimeTicks::Now() - link_start_time).InMicroseconds()); | 337 (base::TimeTicks::Now() - link_start_time).InMicroseconds()); |
339 | 338 |
340 // Shut down the ld subprocess. | 339 // Shut down the ld subprocess. |
341 { | 340 { |
342 base::AutoLock lock(subprocess_mu_); | 341 base::AutoLock lock(subprocess_mu_); |
343 ld_subprocess_active_ = false; | 342 ld_subprocess_active_ = false; |
344 ld_subprocess_->Shutdown(); | |
345 } | 343 } |
346 | 344 |
347 pp::Core* core = pp::Module::Get()->core(); | 345 pp::Core* core = pp::Module::Get()->core(); |
348 core->CallOnMainThread(0, report_translate_finished_, PP_OK); | 346 core->CallOnMainThread(0, report_translate_finished_, PP_OK); |
349 } | 347 } |
350 | 348 |
351 void PnaclTranslateThread::TranslateFailed( | 349 void PnaclTranslateThread::TranslateFailed( |
352 PP_NaClError err_code, | 350 PP_NaClError err_code, |
353 const std::string& error_string) { | 351 const std::string& error_string) { |
354 pp::Core* core = pp::Module::Get()->core(); | 352 pp::Core* core = pp::Module::Get()->core(); |
(...skipping 29 matching lines...) Expand all Loading... |
384 buffer_cond_.Signal(); | 382 buffer_cond_.Signal(); |
385 } | 383 } |
386 | 384 |
387 PnaclTranslateThread::~PnaclTranslateThread() { | 385 PnaclTranslateThread::~PnaclTranslateThread() { |
388 AbortSubprocesses(); | 386 AbortSubprocesses(); |
389 if (translate_thread_) | 387 if (translate_thread_) |
390 translate_thread_->Join(); | 388 translate_thread_->Join(); |
391 } | 389 } |
392 | 390 |
393 } // namespace plugin | 391 } // namespace plugin |
OLD | NEW |