diff options
author | ncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-24 22:46:46 +0000 |
---|---|---|
committer | ncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-24 22:46:46 +0000 |
commit | 9e93fd0a58a89002a6b24ba60c4fe2d5b7a971f3 (patch) | |
tree | 870bb6b421d86c22733357b331a211875f190855 /ppapi | |
parent | 1fc15d3aebb012caebb4f8e5719054d873e2e682 (diff) | |
download | chromium_src-9e93fd0a58a89002a6b24ba60c4fe2d5b7a971f3.zip chromium_src-9e93fd0a58a89002a6b24ba60c4fe2d5b7a971f3.tar.gz chromium_src-9e93fd0a58a89002a6b24ba60c4fe2d5b7a971f3.tar.bz2 |
NaCl: distinguish between installed and hosted apps for load status UMA.
This will help determine if nexe loading problems are caused by networking
issues, or not. A somewhat counter-intuitive aspect of this change is that
the classification of "installed app" vs. "not an installed app" may change at
different points in the load process, depending on where the manifest and nexe
are loaded from. For example, if the manifest is loaded from a chrome-extension
URL, the load will be initially classified as an "installed app". If the nexe
load then comes from an http URL, the classification will switch to "not an
installed app". This means that the load status will be classified based on if
the last resource we attempted to load came from the disk or from the network.
BUG=171759
Review URL: https://chromiumcodereview.appspot.com/12041061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.cc | 31 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.h | 11 |
2 files changed, 36 insertions, 6 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index e0aa6cc..7d9dbbd 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -223,14 +223,28 @@ void HistogramEnumerateOsArch(const std::string& sandbox_isa) { HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); } -void HistogramEnumerateLoadStatus(PluginErrorCode error_code) { +void HistogramEnumerateLoadStatus(PluginErrorCode error_code, + bool is_installed) { HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX, ERROR_UNKNOWN); + + // Gather data to see if being installed changes load outcomes. + const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : + "NaCl.LoadStatus.Plugin.NotInstalledApp"; + HistogramEnumerate(name, error_code, ERROR_MAX, + ERROR_UNKNOWN); } -void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code) { +void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, + bool is_installed) { HistogramEnumerate("NaCl.LoadStatus.SelLdr", error_code, NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); + + // Gather data to see if being installed changes load outcomes. + const char* name = is_installed ? "NaCl.LoadStatus.SelLdr.InstalledApp" : + "NaCl.LoadStatus.SelLdr.NotInstalledApp"; + HistogramEnumerate(name, error_code, NACL_ERROR_CODE_MAX, + LOAD_STATUS_UNKNOWN); } void HistogramEnumerateManifestIsDataURI(bool is_data_uri) { @@ -665,6 +679,7 @@ Plugin::Plugin(PP_Instance pp_instance) wrapper_factory_(NULL), last_error_string_(""), enable_dev_interfaces_(false), + is_installed_(false), init_time_(0), ready_time_(0), nexe_size_(0), @@ -1152,6 +1167,7 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) { if (manifest_->GetProgramURL(&program_url, &cache_identity, &error_info, &is_portable)) { + is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION; set_nacl_ready_state(LOADING); // Inform JavaScript that we found a nexe URL to load. EnqueueProgressEvent(kProgressEventProgress); @@ -1206,6 +1222,8 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { } PLUGIN_PRINTF(("Plugin::RequestNaClManifest (resolved url='%s')\n", nmf_resolved_url.AsString().c_str())); + is_installed_ = GetUrlScheme(nmf_resolved_url.AsString()) == + SCHEME_CHROME_EXTENSION; set_manifest_base_url(nmf_resolved_url.AsString()); set_manifest_url(url); // Inform JavaScript that a load is starting. @@ -1325,7 +1343,7 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, kProgressEventLoadEnd, url, length_computable, loaded_bytes, total_bytes); // UMA - HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS); + HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_); } @@ -1355,7 +1373,7 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { EnqueueProgressEvent(kProgressEventLoadEnd); // UMA - HistogramEnumerateLoadStatus(error_info.error_code()); + HistogramEnumerateLoadStatus(error_info.error_code(), is_installed_); } @@ -1373,7 +1391,7 @@ void Plugin::ReportLoadAbort() { EnqueueProgressEvent(kProgressEventLoadEnd); // UMA - HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED); + HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED, is_installed_); } void Plugin::UpdateDownloadProgress( @@ -1467,7 +1485,8 @@ void Plugin::EnqueueProgressEvent(const char* event_type, } void Plugin::ReportSelLdrLoadStatus(int status) { - HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status)); + HistogramEnumerateSelLdrLoadStatus(static_cast<NaClErrorCode>(status), + is_installed_); } void Plugin::DispatchProgressEvent(int32_t result) { diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 619d7fc..242989d 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -436,6 +436,17 @@ class Plugin : public pp::InstancePrivate { // PPAPI Dev interfaces are disabled by default. bool enable_dev_interfaces_; + // A flag indicating if the NaCl executable is being loaded from an installed + // application. This flag is used to bucket UMA statistics more precisely to + // help determine whether nexe loading problems are caused by networking + // issues. (Installed applications will be loaded from disk.) + // Unfortunately, the definition of what it means to be part of an installed + // application is a little murky - for example an installed application can + // register a mime handler that loads NaCl executables into an arbitrary web + // page. As such, the flag actually means "our best guess, based on the URLs + // for NaCl resources that we have seen so far". + bool is_installed_; + // If we get a DidChangeView event before the nexe is loaded, we store it and // replay it to nexe after it's loaded. We need to replay when this View // resource is non-is_null(). |