Commit 8b158e44 authored by teravest@chromium.org's avatar teravest@chromium.org

Pepper: Remove Plugin::EnqueueProgressEvent.

This wrapper isn't providing much benefit; we may as well tear it out. This
also removes the LengthComputable enum.

BUG=239656
R=dmichael@chromium.org

Review URL: https://codereview.chromium.org/316653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274598 0039d316-1c4b-4281-b951-d872f2087c98
parent 99951c90
......@@ -559,29 +559,6 @@ void Plugin::ReportSelLdrLoadStatus(int status) {
HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status));
}
void Plugin::EnqueueProgressEvent(PP_NaClEventType event_type,
const nacl::string& url,
LengthComputable length_computable,
uint64_t loaded_bytes,
uint64_t total_bytes) {
PLUGIN_PRINTF(("Plugin::EnqueueProgressEvent ("
"event_type='%d', url='%s', length_computable=%d, "
"loaded=%" NACL_PRIu64 ", total=%" NACL_PRIu64 ")\n",
static_cast<int>(event_type),
url.c_str(),
static_cast<int>(length_computable),
loaded_bytes,
total_bytes));
nacl_interface_->DispatchEvent(
pp_instance(),
event_type,
url.c_str(),
length_computable == LENGTH_IS_COMPUTABLE ? PP_TRUE : PP_FALSE,
loaded_bytes,
total_bytes);
}
bool Plugin::DocumentCanRequest(const std::string& url) {
CHECK(pp::Module::Get()->core()->IsMainThread());
CHECK(pp::URLUtil_Dev::Get() != NULL);
......
......@@ -110,10 +110,6 @@ class Plugin : public pp::Instance {
PP_FileHandle file_handle,
ErrorInfo* error_info);
enum LengthComputable {
LENGTH_IS_NOT_COMPUTABLE = 0,
LENGTH_IS_COMPUTABLE = 1
};
// Report successful loading of a module.
void ReportLoadSuccess(uint64_t loaded_bytes, uint64_t total_bytes);
// Report an error that was encountered while loading a module.
......@@ -121,17 +117,6 @@ class Plugin : public pp::Instance {
// Report loading a module was aborted, typically due to user action.
void ReportLoadAbort();
// Dispatch a JavaScript event to indicate a key step in loading.
// |event_type| is a character string indicating which type of progress
// event (loadstart, progress, error, abort, load, loadend). Events are
// enqueued on the JavaScript event loop, which then calls back through
// DispatchProgressEvent.
void EnqueueProgressEvent(PP_NaClEventType event_type,
const nacl::string& url,
LengthComputable length_computable,
uint64_t loaded_bytes,
uint64_t total_bytes);
// Report the error code that sel_ldr produces when starting a nexe.
void ReportSelLdrLoadStatus(int status);
......
......@@ -256,11 +256,12 @@ void PnaclCoordinator::TranslateFinished(int32_t pp_error) {
// that were delayed (see the delay inserted in BitcodeGotCompiled).
if (ExpectedProgressKnown()) {
pexe_bytes_compiled_ = expected_pexe_size_;
plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS,
pexe_url_,
plugin::Plugin::LENGTH_IS_COMPUTABLE,
pexe_bytes_compiled_,
expected_pexe_size_);
GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
PP_NACL_EVENT_PROGRESS,
pexe_url_.c_str(),
PP_TRUE,
pexe_bytes_compiled_,
expected_pexe_size_);
}
// If there are no errors, report stats from this thread (the main thread).
......@@ -549,18 +550,20 @@ void PnaclCoordinator::BitcodeGotCompiled(int32_t pp_error,
// that bytes were sent to the compiler.
if (ExpectedProgressKnown()) {
if (!ShouldDelayProgressEvent()) {
plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS,
pexe_url_,
plugin::Plugin::LENGTH_IS_COMPUTABLE,
pexe_bytes_compiled_,
expected_pexe_size_);
GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
PP_NACL_EVENT_PROGRESS,
pexe_url_.c_str(),
PP_TRUE,
pexe_bytes_compiled_,
expected_pexe_size_);
}
} else {
plugin_->EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS,
pexe_url_,
plugin::Plugin::LENGTH_IS_NOT_COMPUTABLE,
pexe_bytes_compiled_,
expected_pexe_size_);
GetNaClInterface()->DispatchEvent(plugin_->pp_instance(),
PP_NACL_EVENT_PROGRESS,
pexe_url_.c_str(),
PP_FALSE,
pexe_bytes_compiled_,
expected_pexe_size_);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment