Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Module for sending log entries to the server. | 7 * Module for sending log entries to the server. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // Don't accumulate connection statistics across state changes. | 86 // Don't accumulate connection statistics across state changes. |
| 87 this.logAccumulatedStatistics_(); | 87 this.logAccumulatedStatistics_(); |
| 88 this.statsAccumulator_.empty(); | 88 this.statsAccumulator_.empty(); |
| 89 // Maybe clear the session ID. | 89 // Maybe clear the session ID. |
| 90 if (remoting.LogToServer.isEndOfSession_(state)) { | 90 if (remoting.LogToServer.isEndOfSession_(state)) { |
| 91 this.clearSessionId_(); | 91 this.clearSessionId_(); |
| 92 } | 92 } |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 Logs the time taken from session start to connection completed. | |
| 97 */ | |
| 98 remoting.LogToServer.prototype.logTotalTimeForInitialConnection = | |
| 99 function(connectionType) { | |
| 100 // Log the total connection time. | |
| 101 var entry = remoting.ServerLogEntry.makeTotalTimeForInitialConnection( | |
| 102 this.sessionId_, this.mode_, | |
| 103 (new Date().getTime() - this.sessionStartTime_) / 1000.0); | |
|
Jamie
2015/02/25 21:12:35
I would log in ms, not s (that's what I used for t
anandc
2015/02/26 20:21:49
Done.
| |
| 104 this.log_(entry); | |
| 105 }; | |
| 106 | |
| 107 | |
| 108 /** | |
| 96 * Set the connection type (direct, stun relay). | 109 * Set the connection type (direct, stun relay). |
| 97 * | 110 * |
| 98 * @param {string} connectionType | 111 * @param {string} connectionType |
| 99 */ | 112 */ |
| 100 remoting.LogToServer.prototype.setConnectionType = function(connectionType) { | 113 remoting.LogToServer.prototype.setConnectionType = function(connectionType) { |
| 101 this.connectionType_ = connectionType; | 114 this.connectionType_ = connectionType; |
| 102 }; | 115 }; |
| 103 | 116 |
| 104 /** | 117 /** |
| 105 * @param {remoting.SignalStrategy.Type} strategyType | 118 * @param {remoting.SignalStrategy.Type} strategyType |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 remoting.LogToServer.generateSessionId_ = function() { | 283 remoting.LogToServer.generateSessionId_ = function() { |
| 271 var idArray = []; | 284 var idArray = []; |
| 272 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { | 285 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { |
| 273 var index = | 286 var index = |
| 274 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; | 287 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; |
| 275 idArray.push( | 288 idArray.push( |
| 276 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); | 289 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); |
| 277 } | 290 } |
| 278 return idArray.join(''); | 291 return idArray.join(''); |
| 279 }; | 292 }; |
| OLD | NEW |