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_coordinator.h" | 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "native_client/src/include/checked_cast.h" | 10 #include "native_client/src/include/checked_cast.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // Bail out if there was an earlier error (e.g., pexe load failure), | 339 // Bail out if there was an earlier error (e.g., pexe load failure), |
340 // or if there is an error from the translation thread. | 340 // or if there is an error from the translation thread. |
341 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) { | 341 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) { |
342 ExitWithError(); | 342 ExitWithError(); |
343 return; | 343 return; |
344 } | 344 } |
345 // Send out one last progress event, to finish up the progress events | 345 // Send out one last progress event, to finish up the progress events |
346 // that were delayed (see the delay inserted in BitcodeGotCompiled). | 346 // that were delayed (see the delay inserted in BitcodeGotCompiled). |
347 if (ExpectedProgressKnown()) { | 347 if (ExpectedProgressKnown()) { |
348 pexe_bytes_compiled_ = expected_pexe_size_; | 348 pexe_bytes_compiled_ = expected_pexe_size_; |
349 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 349 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
350 pexe_url_, | 350 pexe_url_, |
351 plugin::Plugin::LENGTH_IS_COMPUTABLE, | 351 plugin::Plugin::LENGTH_IS_COMPUTABLE, |
352 pexe_bytes_compiled_, | 352 pexe_bytes_compiled_, |
353 expected_pexe_size_); | 353 expected_pexe_size_); |
354 } | 354 } |
355 | 355 |
356 // If there are no errors, report stats from this thread (the main thread). | 356 // If there are no errors, report stats from this thread (the main thread). |
357 HistogramOptLevel(pnacl_options_.opt_level()); | 357 HistogramOptLevel(pnacl_options_.opt_level()); |
358 const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); | 358 const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); |
359 HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", | 359 HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (!ExpectedProgressKnown()) { | 635 if (!ExpectedProgressKnown()) { |
636 int64_t amount_downloaded; // dummy variable. | 636 int64_t amount_downloaded; // dummy variable. |
637 streaming_downloader_->GetDownloadProgress(&amount_downloaded, | 637 streaming_downloader_->GetDownloadProgress(&amount_downloaded, |
638 &expected_pexe_size_); | 638 &expected_pexe_size_); |
639 } | 639 } |
640 // Hold off reporting the last few bytes of progress, since we don't know | 640 // Hold off reporting the last few bytes of progress, since we don't know |
641 // when they are actually completely compiled. "bytes_compiled" only means | 641 // when they are actually completely compiled. "bytes_compiled" only means |
642 // that bytes were sent to the compiler. | 642 // that bytes were sent to the compiler. |
643 if (ExpectedProgressKnown()) { | 643 if (ExpectedProgressKnown()) { |
644 if (!ShouldDelayProgressEvent()) { | 644 if (!ShouldDelayProgressEvent()) { |
645 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 645 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
646 pexe_url_, | 646 pexe_url_, |
647 plugin::Plugin::LENGTH_IS_COMPUTABLE, | 647 plugin::Plugin::LENGTH_IS_COMPUTABLE, |
648 pexe_bytes_compiled_, | 648 pexe_bytes_compiled_, |
649 expected_pexe_size_); | 649 expected_pexe_size_); |
650 } | 650 } |
651 } else { | 651 } else { |
652 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 652 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
653 pexe_url_, | 653 pexe_url_, |
654 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, | 654 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, |
655 pexe_bytes_compiled_, | 655 pexe_bytes_compiled_, |
656 expected_pexe_size_); | 656 expected_pexe_size_); |
657 } | 657 } |
658 } | 658 } |
659 | 659 |
660 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback( | 660 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback( |
661 int64_t bytes_compiled) { | 661 int64_t bytes_compiled) { |
662 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled, | 662 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 obj_file_.get(), | 699 obj_file_.get(), |
700 temp_nexe_file_.get(), | 700 temp_nexe_file_.get(), |
701 &error_info_, | 701 &error_info_, |
702 resources_.get(), | 702 resources_.get(), |
703 &pnacl_options_, | 703 &pnacl_options_, |
704 this, | 704 this, |
705 plugin_); | 705 plugin_); |
706 } | 706 } |
707 | 707 |
708 } // namespace plugin | 708 } // namespace plugin |
OLD | NEW |