Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc

Issue 316653002: Pepper: Remove Plugin::EnqueueProgressEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // or if there is an error from the translation thread. 249 // or if there is an error from the translation thread.
250 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) { 250 if (translate_finish_error_ != PP_OK || pp_error != PP_OK) {
251 plugin_->ReportLoadError(error_info_); 251 plugin_->ReportLoadError(error_info_);
252 ExitWithError(); 252 ExitWithError();
253 return; 253 return;
254 } 254 }
255 // Send out one last progress event, to finish up the progress events 255 // Send out one last progress event, to finish up the progress events
256 // that were delayed (see the delay inserted in BitcodeGotCompiled). 256 // that were delayed (see the delay inserted in BitcodeGotCompiled).
257 if (ExpectedProgressKnown()) { 257 if (ExpectedProgressKnown()) {
258 pexe_bytes_compiled_ = expected_pexe_size_; 258 pexe_bytes_compiled_ = expected_pexe_size_;
259 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, 259 GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
260 pexe_url_, 260 PP_NACL_EVENT_PROGRESS,
261 plugin::Plugin::LENGTH_IS_COMPUTABLE, 261 pexe_url_.c_str(),
262 pexe_bytes_compiled_, 262 PP_TRUE,
263 expected_pexe_size_); 263 pexe_bytes_compiled_,
264 expected_pexe_size_);
264 } 265 }
265 266
266 // If there are no errors, report stats from this thread (the main thread). 267 // If there are no errors, report stats from this thread (the main thread).
267 HistogramOptLevel(plugin_->uma_interface(), pnacl_options_.opt_level); 268 HistogramOptLevel(plugin_->uma_interface(), pnacl_options_.opt_level);
268 HistogramKBPerSec(plugin_->uma_interface(), 269 HistogramKBPerSec(plugin_->uma_interface(),
269 "NaCl.Perf.PNaClLoadTime.CompileKBPerSec", 270 "NaCl.Perf.PNaClLoadTime.CompileKBPerSec",
270 pexe_size_ / 1024.0, 271 pexe_size_ / 1024.0,
271 translate_thread_->GetCompileTime() / 1000000.0); 272 translate_thread_->GetCompileTime() / 1000000.0);
272 HistogramSizeKB(plugin_->uma_interface(), "NaCl.Perf.Size.Pexe", 273 HistogramSizeKB(plugin_->uma_interface(), "NaCl.Perf.Size.Pexe",
273 static_cast<int64_t>(pexe_size_ / 1024)); 274 static_cast<int64_t>(pexe_size_ / 1024));
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 if (!ExpectedProgressKnown()) { 543 if (!ExpectedProgressKnown()) {
543 int64_t amount_downloaded; // dummy variable. 544 int64_t amount_downloaded; // dummy variable.
544 streaming_downloader_->GetDownloadProgress(&amount_downloaded, 545 streaming_downloader_->GetDownloadProgress(&amount_downloaded,
545 &expected_pexe_size_); 546 &expected_pexe_size_);
546 } 547 }
547 // Hold off reporting the last few bytes of progress, since we don't know 548 // Hold off reporting the last few bytes of progress, since we don't know
548 // when they are actually completely compiled. "bytes_compiled" only means 549 // when they are actually completely compiled. "bytes_compiled" only means
549 // that bytes were sent to the compiler. 550 // that bytes were sent to the compiler.
550 if (ExpectedProgressKnown()) { 551 if (ExpectedProgressKnown()) {
551 if (!ShouldDelayProgressEvent()) { 552 if (!ShouldDelayProgressEvent()) {
552 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, 553 GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
553 pexe_url_, 554 PP_NACL_EVENT_PROGRESS,
554 plugin::Plugin::LENGTH_IS_COMPUTABLE, 555 pexe_url_.c_str(),
555 pexe_bytes_compiled_, 556 PP_TRUE,
556 expected_pexe_size_); 557 pexe_bytes_compiled_,
558 expected_pexe_size_);
557 } 559 }
558 } else { 560 } else {
559 plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS, 561 GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
560 pexe_url_, 562 PP_NACL_EVENT_PROGRESS,
561 plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE, 563 pexe_url_.c_str(),
562 pexe_bytes_compiled_, 564 PP_FALSE,
563 expected_pexe_size_); 565 pexe_bytes_compiled_,
566 expected_pexe_size_);
564 } 567 }
565 } 568 }
566 569
567 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback( 570 pp::CompletionCallback PnaclCoordinator::GetCompileProgressCallback(
568 int64_t bytes_compiled) { 571 int64_t bytes_compiled) {
569 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled, 572 return callback_factory_.NewCallback(&PnaclCoordinator::BitcodeGotCompiled,
570 bytes_compiled); 573 bytes_compiled);
571 } 574 }
572 575
573 void PnaclCoordinator::DoUMATimeMeasure(int32_t pp_error, 576 void PnaclCoordinator::DoUMATimeMeasure(int32_t pp_error,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 invalid_desc_wrapper_.get(), 609 invalid_desc_wrapper_.get(),
607 &error_info_, 610 &error_info_,
608 resources_.get(), 611 resources_.get(),
609 &pnacl_options_, 612 &pnacl_options_,
610 architecture_attributes_, 613 architecture_attributes_,
611 this, 614 this,
612 plugin_); 615 plugin_);
613 } 616 }
614 617
615 } // namespace plugin 618 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698