Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: remoting/webapp/crd/js/server_log_entry.js

Issue 1004513002: Eliminated named constants for instances of remoting.Error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/webapp/crd/js/remoting.js ('k') | remoting/webapp/crd/js/session_connector_impl.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error';
85 85
86 /** 86 /**
87 * @private 87 * @private
88 * @param {!remoting.Error} connectionError 88 * @param {!remoting.Error} connectionError
89 * @return {string} 89 * @return {string}
90 */ 90 */
91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) { 91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) {
92 // Directory service should be updated if a new string is added here as 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). 93 // otherwise the error code will be ignored (i.e. recorded as 0 instead).
94 switch (connectionError.tag) { 94 switch (connectionError.getTag()) {
95 case remoting.Error.Tag.NONE: 95 case remoting.Error.Tag.NONE:
96 return 'none'; 96 return 'none';
97 case remoting.Error.Tag.INVALID_ACCESS_CODE: 97 case remoting.Error.Tag.INVALID_ACCESS_CODE:
98 return 'invalid-access-code'; 98 return 'invalid-access-code';
99 case remoting.Error.Tag.MISSING_PLUGIN: 99 case remoting.Error.Tag.MISSING_PLUGIN:
100 return 'missing_plugin'; 100 return 'missing_plugin';
101 case remoting.Error.Tag.AUTHENTICATION_FAILED: 101 case remoting.Error.Tag.AUTHENTICATION_FAILED:
102 return 'authentication-failed'; 102 return 'authentication-failed';
103 case remoting.Error.Tag.HOST_IS_OFFLINE: 103 case remoting.Error.Tag.HOST_IS_OFFLINE:
104 return 'host-is-offline'; 104 return 'host-is-offline';
105 case remoting.Error.Tag.INCOMPATIBLE_PROTOCOL: 105 case remoting.Error.Tag.INCOMPATIBLE_PROTOCOL:
106 return 'incompatible-protocol'; 106 return 'incompatible-protocol';
107 case remoting.Error.Tag.BAD_PLUGIN_VERSION: 107 case remoting.Error.Tag.BAD_PLUGIN_VERSION:
108 return 'bad-plugin-version'; 108 return 'bad-plugin-version';
109 case remoting.Error.Tag.NETWORK_FAILURE: 109 case remoting.Error.Tag.NETWORK_FAILURE:
110 return 'network-failure'; 110 return 'network-failure';
111 case remoting.Error.Tag.HOST_OVERLOAD: 111 case remoting.Error.Tag.HOST_OVERLOAD:
112 return 'host-overload'; 112 return 'host-overload';
113 case remoting.Error.Tag.P2P_FAILURE: 113 case remoting.Error.Tag.P2P_FAILURE:
114 return 'p2p-failure'; 114 return 'p2p-failure';
115 case remoting.Error.Tag.UNEXPECTED: 115 case remoting.Error.Tag.UNEXPECTED:
116 return 'unexpected'; 116 return 'unexpected';
117 default: 117 default:
118 return 'unknown-' + connectionError; 118 return 'unknown-' + connectionError.getTag();
119 } 119 }
120 }; 120 };
121 121
122
123 /** @private */ 122 /** @private */
124 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = 123 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ =
125 "connection-statistics"; 124 "connection-statistics";
126 /** @private */ 125 /** @private */
127 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth"; 126 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth";
128 /** @private */ 127 /** @private */
129 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency"; 128 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_ = "capture-latency";
130 /** @private */ 129 /** @private */
131 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency"; 130 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_ = "encode-latency";
132 /** @private */ 131 /** @private */
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 */ 223 */
225 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, 224 remoting.ServerLogEntry.makeClientSessionStateChange = function(state,
226 connectionError, mode) { 225 connectionError, mode) {
227 var entry = new remoting.ServerLogEntry(); 226 var entry = new remoting.ServerLogEntry();
228 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, 227 entry.set_(remoting.ServerLogEntry.KEY_ROLE_,
229 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); 228 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_);
230 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, 229 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_,
231 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); 230 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_);
232 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, 231 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_,
233 remoting.ServerLogEntry.getValueForSessionState_(state)); 232 remoting.ServerLogEntry.getValueForSessionState_(state));
234 if (connectionError.tag != remoting.Error.NONE) { 233 if (!connectionError.isNone()) {
235 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, 234 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_,
236 remoting.ServerLogEntry.getValueForError_(connectionError)); 235 remoting.ServerLogEntry.getValueForError_(connectionError));
237 } 236 }
238 entry.addModeField(mode); 237 entry.addModeField(mode);
239 return entry; 238 return entry;
240 }; 239 };
241 240
242 /** 241 /**
243 * Makes a log entry for a set of connection statistics. 242 * Makes a log entry for a set of connection statistics.
244 * Returns null if all the statistics were zero. 243 * Returns null if all the statistics were zero.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 case remoting.DesktopConnectedView.Mode.IT2ME: 503 case remoting.DesktopConnectedView.Mode.IT2ME:
505 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; 504 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_;
506 case remoting.DesktopConnectedView.Mode.ME2ME: 505 case remoting.DesktopConnectedView.Mode.ME2ME:
507 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; 506 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_;
508 case remoting.DesktopConnectedView.Mode.APP_REMOTING: 507 case remoting.DesktopConnectedView.Mode.APP_REMOTING:
509 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; 508 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_;
510 default: 509 default:
511 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; 510 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_;
512 } 511 }
513 }; 512 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/remoting.js ('k') | remoting/webapp/crd/js/session_connector_impl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698