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 13 matching lines...) Expand all Loading... | |
| 24 /** @private */ | 24 /** @private */ |
| 25 this.sessionIdGenerationTime_ = 0; | 25 this.sessionIdGenerationTime_ = 0; |
| 26 /** @private */ | 26 /** @private */ |
| 27 this.sessionStartTime_ = new Date().getTime(); | 27 this.sessionStartTime_ = new Date().getTime(); |
| 28 /** @private */ | 28 /** @private */ |
| 29 this.signalStrategy_ = signalStrategy; | 29 this.signalStrategy_ = signalStrategy; |
| 30 /** @private {string} */ | 30 /** @private {string} */ |
| 31 this.connectionType_ = ''; | 31 this.connectionType_ = ''; |
| 32 /** @private */ | 32 /** @private */ |
| 33 this.authTotalTime_ = 0; | 33 this.authTotalTime_ = 0; |
| 34 /** @private {string} */ | |
| 35 this.hostVersion_ = ''; | |
| 34 | 36 |
| 35 this.setSessionId_(); | 37 this.setSessionId_(); |
| 36 signalStrategy.sendConnectionSetupResults(this); | 38 signalStrategy.sendConnectionSetupResults(this); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 // Constants used for generating a session ID. | 41 // Constants used for generating a session ID. |
| 40 /** @private */ | 42 /** @private */ |
| 41 remoting.LogToServer.SESSION_ID_ALPHABET_ = | 43 remoting.LogToServer.SESSION_ID_ALPHABET_ = |
| 42 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; | 44 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; |
| 43 /** @private */ | 45 /** @private */ |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 * @private | 173 * @private |
| 172 * @param {remoting.ServerLogEntry} entry | 174 * @param {remoting.ServerLogEntry} entry |
| 173 */ | 175 */ |
| 174 remoting.LogToServer.prototype.log_ = function(entry) { | 176 remoting.LogToServer.prototype.log_ = function(entry) { |
| 175 // Log the time taken to get to this point from the time this session started. | 177 // Log the time taken to get to this point from the time this session started. |
| 176 // Exclude time taken for authorization. | 178 // Exclude time taken for authorization. |
| 177 var sessionDurationInSeconds = | 179 var sessionDurationInSeconds = |
| 178 (new Date().getTime() - this.sessionStartTime_ - | 180 (new Date().getTime() - this.sessionStartTime_ - |
| 179 this.authTotalTime_) / 1000.0; | 181 this.authTotalTime_) / 1000.0; |
| 180 entry.addSessionDuration(sessionDurationInSeconds); | 182 entry.addSessionDuration(sessionDurationInSeconds); |
| 183 // The host-version will be blank for logs before a session has been created. | |
| 184 // For example, the signal-strategy log-entries won't have host version info. | |
|
Jamie
2015/04/24 20:34:02
Is this true even for multiple connections from th
anandc
2015/04/24 21:36:35
Yes. It's because a new logToServer object is crea
| |
| 185 entry.addHostVersion(this.hostVersion_); | |
| 181 | 186 |
| 182 // Send the stanza to the debug log. | 187 // Send the stanza to the debug log. |
| 183 console.log('Enqueueing log entry:'); | 188 console.log('Enqueueing log entry:'); |
| 184 entry.toDebugLog(1); | 189 entry.toDebugLog(1); |
| 185 | 190 |
| 186 var stanza = '<cli:iq to="' + remoting.settings.DIRECTORY_BOT_JID + '" ' + | 191 var stanza = '<cli:iq to="' + remoting.settings.DIRECTORY_BOT_JID + '" ' + |
| 187 'type="set" xmlns:cli="jabber:client">' + | 192 'type="set" xmlns:cli="jabber:client">' + |
| 188 '<gr:log xmlns:gr="google:remoting">' + | 193 '<gr:log xmlns:gr="google:remoting">' + |
| 189 entry.toStanza() + | 194 entry.toStanza() + |
| 190 '</gr:log>' + | 195 '</gr:log>' + |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 }; | 258 }; |
| 254 | 259 |
| 255 /** | 260 /** |
| 256 * @param {number} totalTime The value of time taken to complete authorization. | 261 * @param {number} totalTime The value of time taken to complete authorization. |
| 257 * @return {void} Nothing. | 262 * @return {void} Nothing. |
| 258 */ | 263 */ |
| 259 remoting.LogToServer.prototype.setAuthTotalTime = function(totalTime) { | 264 remoting.LogToServer.prototype.setAuthTotalTime = function(totalTime) { |
| 260 this.authTotalTime_ = totalTime; | 265 this.authTotalTime_ = totalTime; |
| 261 }; | 266 }; |
| 262 | 267 |
| 268 /** | |
| 269 * @param {string} hostVersion Version of the host for current session. | |
| 270 * @return {void} Nothing. | |
| 271 */ | |
| 272 remoting.LogToServer.prototype.setHostVersion = function(hostVersion) { | |
| 273 this.hostVersion_ = hostVersion; | |
| 274 }; | |
| 275 | |
| OLD | NEW |