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

Unified Diff: remoting/webapp/base/js/client_session.js

Issue 1410563006: [Chromoting] SessionLogger refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: remoting/webapp/base/js/client_session.js
diff --git a/remoting/webapp/base/js/client_session.js b/remoting/webapp/base/js/client_session.js
index 7b3f0cb854149904d21c07097aa006eac77e834e..2051a5bf2c78be8e3d0fc255b5dc31b98c22f65d 100644
--- a/remoting/webapp/base/js/client_session.js
+++ b/remoting/webapp/base/js/client_session.js
@@ -472,7 +472,9 @@ remoting.ClientSession.prototype.onConnectionStatusUpdate =
this.error_ = new remoting.Error(remoting.Error.Tag.P2P_FAILURE);
break;
case remoting.ClientSession.ConnectionError.HOST_OVERLOAD:
- this.error_ = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD);
+ this.error_ = new remoting.Error(
+ remoting.Error.Tag.HOST_OVERLOAD,
+ this.xmppErrorCache_.getFirstErrorStanza());
break;
case remoting.ClientSession.ConnectionError.MAX_SESSION_LENGTH:
this.error_ = new remoting.Error(remoting.Error.Tag.MAX_SESSION_LENGTH);
@@ -562,8 +564,7 @@ remoting.ClientSession.prototype.setState_ = function(newState) {
this.notifyStateChanges_(oldState, this.state_);
// Record state count in an UMA enumerated histogram.
recordState(this.state_);
- this.logger_.logClientSessionStateChange(
- this.state_, this.error_, this.xmppErrorCache_.getFirstError());
+ this.logger_.logSessionStateChange(toSessionState(this.state_), this.error_);
Jamie 2015/11/09 18:46:02 This is a change in semantics. Previously, getFirs
kelvinp 2015/11/09 22:59:10 Good catch.
};
/** @private */
@@ -661,6 +662,37 @@ remoting.ClientSession.prototype.notifyStateChanges_ =
};
/**
+ * TODO(kelvinp): Consolidate the two enums (crbug.com/504200)
+ * @param {remoting.ClientSession.State} state
+ * @return {remoting.ChromotingEvent.SessionState}
+ */
+function toSessionState(state) {
+ var SessionState = remoting.ChromotingEvent.SessionState;
+ switch(state) {
+ case remoting.ClientSession.State.UNKNOWN:
+ return SessionState.UNKNOWN;
+ case remoting.ClientSession.State.INITIALIZING:
+ return SessionState.INITIALIZING;
+ case remoting.ClientSession.State.CONNECTING:
+ return SessionState.CONNECTING;
+ case remoting.ClientSession.State.AUTHENTICATED:
+ return SessionState.AUTHENTICATED;
+ case remoting.ClientSession.State.CONNECTED:
+ return SessionState.CONNECTED;
+ case remoting.ClientSession.State.CLOSED:
+ return SessionState.CLOSED;
+ case remoting.ClientSession.State.FAILED:
+ return SessionState.CONNECTION_FAILED;
+ case remoting.ClientSession.State.CONNECTION_DROPPED:
+ return SessionState.CONNECTION_DROPPED;
+ case remoting.ClientSession.State.CONNECTION_CANCELED:
+ return SessionState.CONNECTION_CANCELED;
+ default:
+ throw new Error('Unknown session state : ' + state);
+ }
+}
+
+/**
* @param {remoting.ClientSession.State} previous
* @param {remoting.ClientSession.State} current
* @return {remoting.ClientSession.State}
« no previous file with comments | « no previous file | remoting/webapp/base/js/client_session_factory.js » ('j') | remoting/webapp/base/js/client_session_factory.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698