| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 case remoting.ClientSession.State.CONNECTION_CANCELED: | 76 case remoting.ClientSession.State.CONNECTION_CANCELED: |
| 77 return 'connection-canceled'; | 77 return 'connection-canceled'; |
| 78 default: | 78 default: |
| 79 return 'undefined-' + state; | 79 return 'undefined-' + state; |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 /** @private */ | 83 /** @private */ |
| 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; | 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; |
| 85 | 85 |
| 86 /** | |
| 87 * @private | |
| 88 * @param {!remoting.Error} connectionError | |
| 89 * @return {string} | |
| 90 */ | |
| 91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) { | |
| 92 // Directory service should be updated if a new string is added here as | |
| 93 // otherwise the error code will be ignored (i.e. recorded as 0 instead). | |
| 94 switch (connectionError.tag) { | |
| 95 case remoting.Error.Tag.NONE: | |
| 96 return 'none'; | |
| 97 case remoting.Error.Tag.INVALID_ACCESS_CODE: | |
| 98 return 'invalid-access-code'; | |
| 99 case remoting.Error.Tag.MISSING_PLUGIN: | |
| 100 return 'missing_plugin'; | |
| 101 case remoting.Error.Tag.AUTHENTICATION_FAILED: | |
| 102 return 'authentication-failed'; | |
| 103 case remoting.Error.Tag.HOST_IS_OFFLINE: | |
| 104 return 'host-is-offline'; | |
| 105 case remoting.Error.Tag.INCOMPATIBLE_PROTOCOL: | |
| 106 return 'incompatible-protocol'; | |
| 107 case remoting.Error.Tag.BAD_PLUGIN_VERSION: | |
| 108 return 'bad-plugin-version'; | |
| 109 case remoting.Error.Tag.NETWORK_FAILURE: | |
| 110 return 'network-failure'; | |
| 111 case remoting.Error.Tag.HOST_OVERLOAD: | |
| 112 return 'host-overload'; | |
| 113 case remoting.Error.Tag.P2P_FAILURE: | |
| 114 return 'p2p-failure'; | |
| 115 case remoting.Error.Tag.UNEXPECTED: | |
| 116 return 'unexpected'; | |
| 117 default: | |
| 118 return 'unknown-' + connectionError; | |
| 119 } | |
| 120 }; | |
| 121 | |
| 122 | |
| 123 /** @private */ | 86 /** @private */ |
| 124 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = | 87 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = |
| 125 "connection-statistics"; | 88 "connection-statistics"; |
| 126 /** @private */ | 89 /** @private */ |
| 127 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth"; | 90 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth"; |
| 128 /** @private */ | 91 /** @private */ |
| 129 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency"; | 92 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency"; |
| 130 /** @private */ | 93 /** @private */ |
| 131 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency"; | 94 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency"; |
| 132 /** @private */ | 95 /** @private */ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 */ | 187 */ |
| 225 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, | 188 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, |
| 226 connectionError, mode) { | 189 connectionError, mode) { |
| 227 var entry = new remoting.ServerLogEntry(); | 190 var entry = new remoting.ServerLogEntry(); |
| 228 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 191 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
| 229 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 192 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
| 230 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 193 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
| 231 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); | 194 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); |
| 232 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, | 195 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, |
| 233 remoting.ServerLogEntry.getValueForSessionState_(state)); | 196 remoting.ServerLogEntry.getValueForSessionState_(state)); |
| 234 if (connectionError.tag != remoting.Error.NONE) { | 197 if (!connectionError.isNone()) { |
| 235 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 198 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
| 236 remoting.ServerLogEntry.getValueForError_(connectionError)); | 199 connectionError.getTagForServerLog()); |
| 237 } | 200 } |
| 238 entry.addModeField(mode); | 201 entry.addModeField(mode); |
| 239 return entry; | 202 return entry; |
| 240 }; | 203 }; |
| 241 | 204 |
| 242 /** | 205 /** |
| 243 * Makes a log entry for a set of connection statistics. | 206 * Makes a log entry for a set of connection statistics. |
| 244 * Returns null if all the statistics were zero. | 207 * Returns null if all the statistics were zero. |
| 245 * | 208 * |
| 246 * @param {remoting.StatsAccumulator} statsAccumulator | 209 * @param {remoting.StatsAccumulator} statsAccumulator |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 case remoting.DesktopConnectedView.Mode.IT2ME: | 467 case remoting.DesktopConnectedView.Mode.IT2ME: |
| 505 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 468 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
| 506 case remoting.DesktopConnectedView.Mode.ME2ME: | 469 case remoting.DesktopConnectedView.Mode.ME2ME: |
| 507 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 470 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
| 508 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 471 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
| 509 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 472 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
| 510 default: | 473 default: |
| 511 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 474 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
| 512 } | 475 } |
| 513 }; | 476 }; |
| OLD | NEW |