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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 remoting.LogToServer.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; | 48 remoting.LogToServer.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; |
49 | 49 |
50 // The time over which to accumulate connection statistics before logging them | 50 // The time over which to accumulate connection statistics before logging them |
51 // to the server, in milliseconds. | 51 // to the server, in milliseconds. |
52 remoting.LogToServer.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; | 52 remoting.LogToServer.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; |
53 | 53 |
54 /** | 54 /** |
55 * Logs a client session state change. | 55 * Logs a client session state change. |
56 * | 56 * |
57 * @param {remoting.ClientSession.State} state | 57 * @param {remoting.ClientSession.State} state |
58 * @param {remoting.Error} connectionError | 58 * @param {!remoting.Error} connectionError |
59 */ | 59 */ |
60 remoting.LogToServer.prototype.logClientSessionStateChange = | 60 remoting.LogToServer.prototype.logClientSessionStateChange = |
61 function(state, connectionError) { | 61 function(state, connectionError) { |
62 this.maybeExpireSessionId_(); | 62 this.maybeExpireSessionId_(); |
63 // Set the session start time if we haven't done so already. | 63 // Set the session start time if we haven't done so already. |
64 if (remoting.LogToServer.isStartOfSession_(state)) { | 64 if (remoting.LogToServer.isStartOfSession_(state)) { |
65 if (this.sessionStartTime_ == 0) { | 65 if (this.sessionStartTime_ == 0) { |
66 this.sessionStartTime_ = new Date().getTime(); | 66 this.sessionStartTime_ = new Date().getTime(); |
67 } | 67 } |
68 } | 68 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 remoting.LogToServer.generateSessionId_ = function() { | 270 remoting.LogToServer.generateSessionId_ = function() { |
271 var idArray = []; | 271 var idArray = []; |
272 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { | 272 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { |
273 var index = | 273 var index = |
274 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; | 274 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; |
275 idArray.push( | 275 idArray.push( |
276 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); | 276 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); |
277 } | 277 } |
278 return idArray.join(''); | 278 return idArray.join(''); |
279 }; | 279 }; |
OLD | NEW |