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

Unified Diff: chrome/browser/resources/hotword/nacl_manager.js

Issue 667873002: Add UMA to hotword trigger extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove incorrect log for message timeout. Created 6 years, 2 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
« no previous file with comments | « chrome/browser/resources/hotword/metrics.js ('k') | chrome/browser/resources/hotword/state_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/hotword/nacl_manager.js
diff --git a/chrome/browser/resources/hotword/nacl_manager.js b/chrome/browser/resources/hotword/nacl_manager.js
index fc0753f834f66fdb64dbd972c867396a98b7b2d4..db23ece082e6e1586ac3d44f56661b41e31e7967 100644
--- a/chrome/browser/resources/hotword/nacl_manager.js
+++ b/chrome/browser/resources/hotword/nacl_manager.js
@@ -77,6 +77,8 @@ NaClManager.ManagerState_ = {
};
var ManagerState_ = NaClManager.ManagerState_;
var Error_ = hotword.constants.Error;
+var UmaNaClMessageTimeout_ = hotword.constants.UmaNaClMessageTimeout;
+var UmaNaClPluginLoadResult_ = hotword.constants.UmaNaClPluginLoadResult;
NaClManager.prototype.__proto__ = cr.EventTarget.prototype;
@@ -92,6 +94,18 @@ NaClManager.prototype.handleError_ = function(error) {
};
/**
+ * Record the result of loading the NaCl plugin to UMA.
+ * @param {!hotword.constants.UmaNaClPluginLoadResult} error
+ * @private
+ */
+NaClManager.prototype.logPluginLoadResult_ = function(error) {
+ hotword.metrics.recordEnum(
+ hotword.constants.UmaMetrics.NACL_PLUGIN_LOAD_RESULT,
+ error,
+ UmaNaClPluginLoadResult_.MAX);
+};
+
+/**
* @return {boolean} True if the recognizer is in a running state.
*/
NaClManager.prototype.isRunning = function() {
@@ -250,11 +264,16 @@ NaClManager.prototype.initialize = function(naclArch, stream) {
false);
plugin.addEventListener('crash',
- this.handleError_.bind(this, Error_.NACL_CRASH),
+ function() {
+ this.handleError_(Error_.NACL_CRASH);
+ this.logPluginLoadResult_(
+ UmaNaClPluginLoadResult_.CRASH);
+ }.bind(this),
false);
return true;
}
this.recognizerState_ = ManagerState_.ERROR;
+ this.logPluginLoadResult_(UmaNaClPluginLoadResult_.NO_MODULE_FOUND);
return false;
};
@@ -297,6 +316,30 @@ NaClManager.prototype.waitForMessage_ = function(timeout, message) {
function() {
this.recognizerState_ = ManagerState_.ERROR;
this.handleError_(Error_.TIMEOUT);
+ switch (this.expectingMessage_) {
+ case hotword.constants.NaClPlugin.REQUEST_MODEL:
+ var metricValue = UmaNaClMessageTimeout_.REQUEST_MODEL;
+ break;
+ case hotword.constants.NaClPlugin.MODEL_LOADED:
+ var metricValue = UmaNaClMessageTimeout_.MODEL_LOADED;
+ break;
+ case hotword.constants.NaClPlugin.READY_FOR_AUDIO:
+ var metricValue = UmaNaClMessageTimeout_.READY_FOR_AUDIO;
+ break;
+ case hotword.constants.NaClPlugin.STOPPED:
+ var metricValue = UmaNaClMessageTimeout_.STOPPED;
+ break;
+ case hotword.constants.NaClPlugin.HOTWORD_DETECTED:
+ var metricValue = UmaNaClMessageTimeout_.HOTWORD_DETECTED;
+ break;
+ case hotword.constants.NaClPlugin.MS_CONFIGURED:
+ var metricValue = UmaNaClMessageTimeout_.MS_CONFIGURED;
+ break;
+ }
+ hotword.metrics.recordEnum(
+ hotword.constants.UmaMetrics.NACL_MESSAGE_TIMEOUT,
+ metricValue,
+ UmaNaClMessageTimeout_.MAX);
}.bind(this), timeout);
this.expectingMessage_ = message;
};
@@ -323,6 +366,7 @@ NaClManager.prototype.handleRequestModel_ = function() {
if (this.recognizerState_ != ManagerState_.LOADING) {
return;
}
+ this.logPluginLoadResult_(UmaNaClPluginLoadResult_.SUCCESS);
this.sendDataToPlugin_(
hotword.constants.NaClPlugin.MODEL_PREFIX + this.modelUrl_);
this.waitForMessage_(hotword.constants.TimeoutMs.LONG,
« no previous file with comments | « chrome/browser/resources/hotword/metrics.js ('k') | chrome/browser/resources/hotword/state_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698