OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @suppress {duplicate} */ | 6 /** @suppress {duplicate} */ |
7 var remoting = remoting || {}; | 7 var remoting = remoting || {}; |
8 | 8 |
9 (function() { | 9 (function() { |
10 | 10 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 this.statsAccumulator_.add(stats); | 256 this.statsAccumulator_.add(stats); |
257 // Send statistics to the server if they've been accumulating for at least | 257 // Send statistics to the server if they've been accumulating for at least |
258 // 60 seconds. | 258 // 60 seconds. |
259 if (this.statsAccumulator_.getTimeSinceFirstValue() >= | 259 if (this.statsAccumulator_.getTimeSinceFirstValue() >= |
260 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME) { | 260 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME) { |
261 this.logAccumulatedStatistics_(); | 261 this.logAccumulatedStatistics_(); |
262 } | 262 } |
263 }; | 263 }; |
264 | 264 |
265 /** | 265 /** |
266 * Logs connection statistics. | |
Lambros
2016/09/28 01:30:39
Wrong comment.
Jamie
2016/09/28 21:14:36
Done.
| |
267 * | |
268 * @param {{width: number, height: number}} hostSize | |
269 * @param {{width: number, height: number}} clientSize | |
270 * @param {boolean} clientFullscreen | |
271 */ | |
272 remoting.SessionLogger.prototype.logScreenResolutions = | |
273 function(hostSize, clientSize, clientFullscreen) { | |
274 this.maybeExpireSessionId_(); | |
275 var entry = this.makeScreenResolutions_(hostSize, clientSize, | |
276 clientFullscreen); | |
277 this.log_(entry); | |
278 }; | |
279 | |
280 /** | |
266 * @param {remoting.ChromotingEvent.SessionState} state | 281 * @param {remoting.ChromotingEvent.SessionState} state |
267 * @param {remoting.Error=} opt_error | 282 * @param {remoting.Error=} opt_error |
268 * @return {remoting.ChromotingEvent} | 283 * @return {remoting.ChromotingEvent} |
269 * @private | 284 * @private |
270 */ | 285 */ |
271 remoting.SessionLogger.prototype.makeSessionStateChange_ = | 286 remoting.SessionLogger.prototype.makeSessionStateChange_ = |
272 function(state, opt_error) { | 287 function(state, opt_error) { |
273 var entry = new remoting.ChromotingEvent( | 288 var entry = new remoting.ChromotingEvent( |
274 remoting.ChromotingEvent.Type.SESSION_STATE); | 289 remoting.ChromotingEvent.Type.SESSION_STATE); |
275 | 290 |
276 var ConnectionError = remoting.ChromotingEvent.ConnectionError; | 291 var ConnectionError = remoting.ChromotingEvent.ConnectionError; |
277 | 292 |
278 if (!opt_error) { | 293 if (!opt_error) { |
279 entry.connection_error = ConnectionError.NONE; | 294 entry.connection_error = ConnectionError.NONE; |
280 } else if (opt_error instanceof remoting.Error) { | 295 } else if (opt_error instanceof remoting.Error) { |
281 entry.setError(opt_error); | 296 entry.setError(opt_error); |
282 } else { | 297 } else { |
283 entry.connection_error = ConnectionError.UNKNOWN_ERROR; | 298 entry.connection_error = ConnectionError.UNKNOWN_ERROR; |
284 } | 299 } |
285 | 300 |
286 entry.session_state = state; | 301 entry.session_state = state; |
287 | 302 |
288 this.fillEvent_(entry); | 303 this.fillEvent_(entry); |
289 return entry; | 304 return entry; |
290 }; | 305 }; |
291 | 306 |
292 /** | 307 /** |
308 * @param {{width: number, height: number}} hostSize | |
309 * @param {{width: number, height: number}} clientSize | |
310 * @param {boolean} clientFullscreen | |
311 * @return {remoting.ChromotingEvent} | |
312 * @private | |
313 */ | |
314 remoting.SessionLogger.prototype.makeScreenResolutions_ = | |
315 function(hostSize, clientSize, clientFullscreen) { | |
316 var entry = new remoting.ChromotingEvent( | |
317 remoting.ChromotingEvent.Type.SCREEN_RESOLUTIONS); | |
318 entry.client_resolution = new remoting.ChromotingEvent.ScreenResolution( | |
319 clientSize.width, clientSize.height); | |
320 entry.host_resolution = new remoting.ChromotingEvent.ScreenResolution( | |
321 hostSize.width, hostSize.height); | |
322 entry.client_fullscreen = clientFullscreen; | |
323 this.fillEvent_(entry); | |
324 return entry; | |
325 }; | |
326 | |
327 /** | |
293 * @return {remoting.ChromotingEvent} | 328 * @return {remoting.ChromotingEvent} |
294 * @private | 329 * @private |
295 */ | 330 */ |
296 remoting.SessionLogger.prototype.makeSessionIdNew_ = function() { | 331 remoting.SessionLogger.prototype.makeSessionIdNew_ = function() { |
297 var entry = new remoting.ChromotingEvent( | 332 var entry = new remoting.ChromotingEvent( |
298 remoting.ChromotingEvent.Type.SESSION_ID_NEW); | 333 remoting.ChromotingEvent.Type.SESSION_ID_NEW); |
299 this.fillEvent_(entry); | 334 this.fillEvent_(entry); |
300 return entry; | 335 return entry; |
301 }; | 336 }; |
302 | 337 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 } | 549 } |
515 | 550 |
516 // The maximum age of a session ID, in milliseconds. | 551 // The maximum age of a session ID, in milliseconds. |
517 remoting.SessionLogger.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; | 552 remoting.SessionLogger.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; |
518 | 553 |
519 // The time over which to accumulate connection statistics before logging them | 554 // The time over which to accumulate connection statistics before logging them |
520 // to the server, in milliseconds. | 555 // to the server, in milliseconds. |
521 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; | 556 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; |
522 | 557 |
523 })(); | 558 })(); |
OLD | NEW |