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

Unified Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 231243002: PPAPI: Move some of NexeFileDidOpen to NexeLoadManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix crash Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/trusted/plugin/plugin.cc
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 9de8e0fedccf5531bccccb59d398b53ff528e3e1..4fd6ba0d44cdeb1d830ba8075ed574e20b36a3c3 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -191,8 +191,7 @@ void Plugin::HistogramEnumerateManifestIsDataURI(bool is_data_uri) {
HistogramEnumerate("NaCl.Manifest.IsDataURI", is_data_uri, 2, -1);
}
-void Plugin::HistogramHTTPStatusCode(const std::string& name,
- int status) {
+void Plugin::HistogramHTTPStatusCode(const std::string& name, int status) {
// Log the status codes in rough buckets - 1XX, 2XX, etc.
int sample = status / 100;
// HTTP status codes only go up to 5XX, using "6" to indicate an internal
@@ -614,54 +613,26 @@ void Plugin::HistogramStartupTimeMedium(const std::string& name, float dt) {
}
void Plugin::NexeFileDidOpen(int32_t pp_error) {
- PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (pp_error=%" NACL_PRId32 ")\n",
- pp_error));
NaClFileInfo tmp_info(nexe_downloader_.GetFileInfo());
NaClFileInfoAutoCloser info(&tmp_info);
- PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (file_desc=%" NACL_PRId32 ")\n",
- info.get_desc()));
- HistogramHTTPStatusCode(
- nacl_interface_->GetIsInstalled(pp_instance()) ?
- "NaCl.HttpStatusCodeClass.Nexe.InstalledApp" :
- "NaCl.HttpStatusCodeClass.Nexe.NotInstalledApp",
- nexe_downloader_.status_code());
- ErrorInfo error_info;
- if (pp_error != PP_OK || info.get_desc() == NACL_NO_FILE_DESC) {
- if (pp_error == PP_ERROR_ABORTED) {
- ReportLoadAbort();
- } else if (pp_error == PP_ERROR_NOACCESS) {
- error_info.SetReport(PP_NACL_ERROR_NEXE_NOACCESS_URL,
- "access to nexe url was denied.");
- ReportLoadError(error_info);
- } else {
- error_info.SetReport(PP_NACL_ERROR_NEXE_LOAD_URL,
- "could not load nexe url.");
- ReportLoadError(error_info);
- }
- return;
- }
- struct stat stat_buf;
- if (0 != fstat(info.get_desc(), &stat_buf)) {
- error_info.SetReport(PP_NACL_ERROR_NEXE_STAT, "could not stat nexe file.");
- ReportLoadError(error_info);
- return;
+
+ int64_t nexe_bytes_read = -1;
+ if (pp_error == PP_OK && info.get_desc() != NACL_NO_FILE_DESC) {
+ struct stat stat_buf;
+ if (0 == fstat(info.get_desc(), &stat_buf))
+ nexe_bytes_read = stat_buf.st_size;
}
- size_t nexe_bytes_read = static_cast<size_t>(stat_buf.st_size);
- nacl_interface_->SetNexeSize(pp_instance(), nexe_bytes_read);
- HistogramSizeKB("NaCl.Perf.Size.Nexe",
- static_cast<int32_t>(nexe_bytes_read / 1024));
+ nacl_interface_->NexeFileDidOpen(pp_instance(),
+ pp_error,
+ info.get_desc(),
+ nexe_downloader_.status_code(),
+ nexe_bytes_read,
+ nexe_downloader_.url().c_str());
HistogramStartupTimeMedium(
"NaCl.Perf.StartupTime.NexeDownload",
static_cast<float>(nexe_downloader_.TimeSinceOpenMilliseconds()));
- // Inform JavaScript that we successfully downloaded the nacl module.
- EnqueueProgressEvent(PP_NACL_EVENT_PROGRESS,
- nexe_downloader_.url(),
- LENGTH_IS_COMPUTABLE,
- nexe_bytes_read,
- nexe_bytes_read);
-
load_start_ = NaClGetTimeOfDayMicroseconds();
nacl::scoped_ptr<nacl::DescWrapper>
wrapper(wrapper_factory()->MakeFileDesc(info.Release().desc, O_RDONLY));
« no previous file with comments | « ppapi/generators/test_cgen_range/versions.idl ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698