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 * A class of server log entries. | 7 * A class of server log entries. |
8 * | 8 * |
9 * Any changes to the values here need to be coordinated with the host and | 9 * Any changes to the values here need to be coordinated with the host and |
10 * server/log proto code. | 10 * server/log proto code. |
(...skipping 29 matching lines...) Expand all Loading... |
40 /** @private */ | 40 /** @private */ |
41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; | 41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; |
42 /** @private */ | 42 /** @private */ |
43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; | 43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; |
44 /** @private */ | 44 /** @private */ |
45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; | 45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; |
46 /** @private */ | 46 /** @private */ |
47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = | 47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = |
48 'signal-strategy-progress'; | 48 'signal-strategy-progress'; |
49 /** @private */ | 49 /** @private */ |
50 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_ = | 50 remoting.ServerLogEntry.KEY_ELAPSED_TIME_MS_ = 'elapsed-time'; |
51 'signal-strategy-elapsed-time'; | 51 |
52 | 52 |
53 /** | 53 /** |
54 * @private | 54 * @private |
55 * @param {remoting.ClientSession.State} state | 55 * @param {remoting.ClientSession.State} state |
56 * @return {string} | 56 * @return {string} |
57 */ | 57 */ |
58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { | 58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { |
59 switch(state) { | 59 switch(state) { |
60 case remoting.ClientSession.State.UNKNOWN: | 60 case remoting.ClientSession.State.UNKNOWN: |
61 return 'unknown'; | 61 return 'unknown'; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 entry.addModeField(mode); | 350 entry.addModeField(mode); |
351 return entry; | 351 return entry; |
352 }; | 352 }; |
353 | 353 |
354 /** | 354 /** |
355 * Makes a log entry for a "signal strategy fallback" event. | 355 * Makes a log entry for a "signal strategy fallback" event. |
356 * | 356 * |
357 * @param {string} sessionId | 357 * @param {string} sessionId |
358 * @param {remoting.SignalStrategy.Type} strategyType | 358 * @param {remoting.SignalStrategy.Type} strategyType |
359 * @param {remoting.FallbackSignalStrategy.Progress} progress | 359 * @param {remoting.FallbackSignalStrategy.Progress} progress |
360 * @param {number} elapsedTimeInMs | |
361 * @return {remoting.ServerLogEntry} | 360 * @return {remoting.ServerLogEntry} |
362 */ | 361 */ |
363 remoting.ServerLogEntry.makeSignalStrategyProgress = | 362 remoting.ServerLogEntry.makeSignalStrategyProgress = |
364 function(sessionId, strategyType, progress, elapsedTimeInMs) { | 363 function(sessionId, strategyType, progress) { |
365 var entry = new remoting.ServerLogEntry(); | 364 var entry = new remoting.ServerLogEntry(); |
366 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 365 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
367 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 366 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
368 entry.set_( | 367 entry.set_( |
369 remoting.ServerLogEntry.KEY_EVENT_NAME_, | 368 remoting.ServerLogEntry.KEY_EVENT_NAME_, |
370 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); | 369 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); |
371 entry.addSessionIdField(sessionId); | 370 entry.addSessionIdField(sessionId); |
372 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); | 371 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); |
373 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); | 372 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); |
374 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_, | |
375 String(elapsedTimeInMs)); | |
376 | 373 |
377 return entry; | 374 return entry; |
378 }; | 375 }; |
379 | 376 |
380 /** | 377 /** |
381 * Adds a session ID field to this log entry. | 378 * Adds a session ID field to this log entry. |
382 * | 379 * |
383 * @param {string} sessionId | 380 * @param {string} sessionId |
384 */ | 381 */ |
385 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { | 382 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 return { | 457 return { |
461 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, | 458 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, |
462 'os_version': match[2], | 459 'os_version': match[2], |
463 'cpu': match[1] | 460 'cpu': match[1] |
464 }; | 461 }; |
465 } | 462 } |
466 return null; | 463 return null; |
467 }; | 464 }; |
468 | 465 |
469 /** | 466 /** |
| 467 * Adds a field to this log entry specifying the elapsed time since the start of |
| 468 * the session to the current session state. |
| 469 * @param {number} elapsedTimeInMs |
| 470 */ |
| 471 remoting.ServerLogEntry.prototype.addElapsedTimeMs = |
| 472 function(elapsedTimeInMs) { |
| 473 this.set_(remoting.ServerLogEntry.KEY_ELAPSED_TIME_MS_, |
| 474 String(elapsedTimeInMs)); |
| 475 }; |
| 476 |
| 477 |
| 478 /** |
470 * Adds a field specifying the browser version to this log entry. | 479 * Adds a field specifying the browser version to this log entry. |
471 */ | 480 */ |
472 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { | 481 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { |
473 var version = remoting.getChromeVersion(); | 482 var version = remoting.getChromeVersion(); |
474 if (version != null) { | 483 if (version != null) { |
475 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); | 484 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); |
476 } | 485 } |
477 }; | 486 }; |
478 | 487 |
479 /** | 488 /** |
(...skipping 28 matching lines...) Expand all Loading... |
508 case remoting.DesktopConnectedView.Mode.IT2ME: | 517 case remoting.DesktopConnectedView.Mode.IT2ME: |
509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 518 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
510 case remoting.DesktopConnectedView.Mode.ME2ME: | 519 case remoting.DesktopConnectedView.Mode.ME2ME: |
511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 520 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 521 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 522 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
514 default: | 523 default: |
515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 524 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
516 } | 525 } |
517 }; | 526 }; |
OLD | NEW |