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 host and client dimensions. |
| 267 * |
| 268 * @param {{width: number, height: number}} hostSize |
| 269 * @param {{width: number, height: number}} clientPluginSize |
| 270 * @param {{width: number, height: number}} clientWindowSize |
| 271 * @param {boolean} clientFullscreen |
| 272 */ |
| 273 remoting.SessionLogger.prototype.logScreenResolutions = |
| 274 function(hostSize, hostDpi, clientPluginSize, clientWindowSize, clientDpi, |
| 275 clientFullscreen) { |
| 276 this.maybeExpireSessionId_(); |
| 277 var entry = this.makeScreenResolutions_(hostSize, hostDpi, clientPluginSize, |
| 278 clientWindowSize, clientDpi, |
| 279 clientFullscreen); |
| 280 this.log_(entry); |
| 281 }; |
| 282 |
| 283 /** |
266 * @param {remoting.ChromotingEvent.SessionState} state | 284 * @param {remoting.ChromotingEvent.SessionState} state |
267 * @param {remoting.Error=} opt_error | 285 * @param {remoting.Error=} opt_error |
268 * @return {remoting.ChromotingEvent} | 286 * @return {remoting.ChromotingEvent} |
269 * @private | 287 * @private |
270 */ | 288 */ |
271 remoting.SessionLogger.prototype.makeSessionStateChange_ = | 289 remoting.SessionLogger.prototype.makeSessionStateChange_ = |
272 function(state, opt_error) { | 290 function(state, opt_error) { |
273 var entry = new remoting.ChromotingEvent( | 291 var entry = new remoting.ChromotingEvent( |
274 remoting.ChromotingEvent.Type.SESSION_STATE); | 292 remoting.ChromotingEvent.Type.SESSION_STATE); |
275 | 293 |
276 var ConnectionError = remoting.ChromotingEvent.ConnectionError; | 294 var ConnectionError = remoting.ChromotingEvent.ConnectionError; |
277 | 295 |
278 if (!opt_error) { | 296 if (!opt_error) { |
279 entry.connection_error = ConnectionError.NONE; | 297 entry.connection_error = ConnectionError.NONE; |
280 } else if (opt_error instanceof remoting.Error) { | 298 } else if (opt_error instanceof remoting.Error) { |
281 entry.setError(opt_error); | 299 entry.setError(opt_error); |
282 } else { | 300 } else { |
283 entry.connection_error = ConnectionError.UNKNOWN_ERROR; | 301 entry.connection_error = ConnectionError.UNKNOWN_ERROR; |
284 } | 302 } |
285 | 303 |
286 entry.session_state = state; | 304 entry.session_state = state; |
287 | 305 |
288 this.fillEvent_(entry); | 306 this.fillEvent_(entry); |
289 return entry; | 307 return entry; |
290 }; | 308 }; |
291 | 309 |
292 /** | 310 /** |
| 311 * @param {{width: number, height: number}} hostSize |
| 312 * @param {{width: number, height: number}} clientPluginSize |
| 313 * @param {{width: number, height: number}} clientWindowSize |
| 314 * @param {boolean} clientFullscreen |
| 315 * @return {remoting.ChromotingEvent} |
| 316 * @private |
| 317 */ |
| 318 remoting.SessionLogger.prototype.makeScreenResolutions_ = |
| 319 function(hostSize, hostDpi, clientPluginSize, clientWindowSize, clientDpi, |
| 320 clientFullscreen) { |
| 321 var entry = new remoting.ChromotingEvent( |
| 322 remoting.ChromotingEvent.Type.SCREEN_RESOLUTIONS); |
| 323 entry.client_video_size = new remoting.ChromotingEvent.ScreenResolution( |
| 324 clientPluginSize.width, clientPluginSize.height, clientDpi); |
| 325 entry.client_window_size = new remoting.ChromotingEvent.ScreenResolution( |
| 326 clientWindowSize.width, clientWindowSize.height, clientDpi); |
| 327 entry.host_all_screens_size = new remoting.ChromotingEvent.ScreenResolution( |
| 328 hostSize.width, hostSize.height, hostDpi); |
| 329 entry.client_fullscreen = clientFullscreen; |
| 330 this.fillEvent_(entry); |
| 331 return entry; |
| 332 }; |
| 333 |
| 334 /** |
293 * @return {remoting.ChromotingEvent} | 335 * @return {remoting.ChromotingEvent} |
294 * @private | 336 * @private |
295 */ | 337 */ |
296 remoting.SessionLogger.prototype.makeSessionIdNew_ = function() { | 338 remoting.SessionLogger.prototype.makeSessionIdNew_ = function() { |
297 var entry = new remoting.ChromotingEvent( | 339 var entry = new remoting.ChromotingEvent( |
298 remoting.ChromotingEvent.Type.SESSION_ID_NEW); | 340 remoting.ChromotingEvent.Type.SESSION_ID_NEW); |
299 this.fillEvent_(entry); | 341 this.fillEvent_(entry); |
300 return entry; | 342 return entry; |
301 }; | 343 }; |
302 | 344 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 556 } |
515 | 557 |
516 // The maximum age of a session ID, in milliseconds. | 558 // The maximum age of a session ID, in milliseconds. |
517 remoting.SessionLogger.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; | 559 remoting.SessionLogger.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; |
518 | 560 |
519 // The time over which to accumulate connection statistics before logging them | 561 // The time over which to accumulate connection statistics before logging them |
520 // to the server, in milliseconds. | 562 // to the server, in milliseconds. |
521 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; | 563 remoting.SessionLogger.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; |
522 | 564 |
523 })(); | 565 })(); |
OLD | NEW |