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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Bail out if there was an earlier error (e.g., pexe load failure), | 337 // Bail out if there was an earlier error (e.g., pexe load failure), |
338 // or if there is an error from the translation thread. | 338 // or if there is an error from the translation thread. |
339 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) { | 339 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) { |
340 ExitWithError(); | 340 ExitWithError(); |
341 return; | 341 return; |
342 } | 342 } |
343 // Send out one last progress event, to finish up the progress events | 343 // Send out one last progress event, to finish up the progress events |
344 // that were delayed (see the delay inserted in BitcodeGotCompiled). | 344 // that were delayed (see the delay inserted in BitcodeGotCompiled). |
345 if (ExpectedProgressKnown()) { | 345 if (ExpectedProgressKnown()) { |
346 pexe_bytes_compiled_ = expected_pexe_size_; | 346 pexe_bytes_compiled_ = expected_pexe_size_; |
347 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 347 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
348 pexe_url_, | 348 pexe_url_, |
349 plugin::Plugin::LENGTH_IS_COMPUTABLE, | 349 plugin::Plugin::LENGTH_IS_COMPUTABLE, |
350 pexe_bytes_compiled_, | 350 pexe_bytes_compiled_, |
351 expected_pexe_size_); | 351 expected_pexe_size_); |
352 } | 352 } |
353 | 353 |
354 // If there are no errors, report stats from this thread (the main thread). | 354 // If there are no errors, report stats from this thread (the main thread). |
355 HistogramOptLevel(pnacl_options_.opt_level()); | 355 HistogramOptLevel(pnacl_options_.opt_level()); |
356 const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); | 356 const plugin::PnaclTimeStats& time_stats = translate_thread_->GetTimeStats(); |
357 HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", | 357 HistogramTime("NaCl.Perf.PNaClLoadTime.LoadCompiler", |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 if (!ExpectedProgressKnown()) { | 627 if (!ExpectedProgressKnown()) { |
628 int64_t amount_downloaded; // dummy variable. | 628 int64_t amount_downloaded; // dummy variable. |
629 streaming_downloader_->GetDownloadProgress(&amount_downloaded, | 629 streaming_downloader_->GetDownloadProgress(&amount_downloaded, |
630 &expected_pexe_size_); | 630 &expected_pexe_size_); |
631 } | 631 } |
632 // Hold off reporting the last few bytes of progress, since we don't know | 632 // Hold off reporting the last few bytes of progress, since we don't know |
633 // when they are actually completely compiled. "bytes_compiled" only means | 633 // when they are actually completely compiled. "bytes_compiled" only means |
634 // that bytes were sent to the compiler. | 634 // that bytes were sent to the compiler. |
635 if (ExpectedProgressKnown()) { | 635 if (ExpectedProgressKnown()) { |
636 if (!ShouldDelayProgressEvent()) { | 636 if (!ShouldDelayProgressEvent()) { |
637 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 637 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
638 pexe_url_, | 638 pexe_url_, |
639 plugin::Plugin::LENGTH_IS_COMPUTABLE, | 639 plugin::Plugin::LENGTH_IS_COMPUTABLE, |
640 pexe_bytes_compiled_, | 640 pexe_bytes_compiled_, |
641 expected_pexe_size_); | 641 expected_pexe_size_); |
642 } | 642 } |
643 } else { | 643 } else { |
644 plugin_->EnqueueProgressEvent(plugin::Plugin::kProgressEventProgress, | 644 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, |
645 pexe_url_, | 645 pexe_url_, |
646 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, | 646 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, |
647 pexe_bytes_compiled_, | 647 pexe_bytes_compiled_, |
648 expected_pexe_size_); | 648 expected_pexe_size_); |
649 } | 649 } |
650 } | 650 } |
651 | 651 |
652 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback( | 652 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback( |
653 int64_t bytes_compiled) { | 653 int64_t bytes_compiled) { |
654 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled, | 654 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 obj_file_.get(), | 691 obj_file_.get(), |
692 temp_nexe_file_.get(), | 692 temp_nexe_file_.get(), |
693 &error_info_, | 693 &error_info_, |
694 resources_.get(), | 694 resources_.get(), |
695 &pnacl_options_, | 695 &pnacl_options_, |
696 this, | 696 this, |
697 plugin_); | 697 plugin_); |
698 } | 698 } |
699 | 699 |
700 } // namespace plugin | 700 } // namespace plugin |
OLD | NEW |