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

Side by Side Diff: chrome/browser/resources/net_internals/main.js

Issue 17333003: Pretty-print QUIC CONNECTION_CLOSE and RST_STREAM error codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 6 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 | Annotate | Revision Log
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 * Dictionary of constants (Initialized soon after loading by data from browser, 6 * Dictionary of constants (Initialized soon after loading by data from browser,
7 * updated on load log). The *Types dictionaries map strings to numeric IDs, 7 * updated on load log). The *Types dictionaries map strings to numeric IDs,
8 * while the *TypeNames are the other way around. 8 * while the *TypeNames are the other way around.
9 */ 9 */
10 var EventType = null; 10 var EventType = null;
11 var EventTypeNames = null; 11 var EventTypeNames = null;
12 var EventPhase = null; 12 var EventPhase = null;
13 var EventSourceType = null; 13 var EventSourceType = null;
14 var EventSourceTypeNames = null; 14 var EventSourceTypeNames = null;
15 var LogLevelType = null; 15 var LogLevelType = null;
16 var ClientInfo = null; 16 var ClientInfo = null;
17 var NetError = null; 17 var NetError = null;
18 var QuicError = null;
19 var QuicRstStreamError = null;
18 var LoadFlag = null; 20 var LoadFlag = null;
19 var LoadState = null; 21 var LoadState = null;
20 var AddressFamily = null; 22 var AddressFamily = null;
21 23
22 /** 24 /**
23 * Dictionary of all constants, used for saving log files. 25 * Dictionary of all constants, used for saving log files.
24 */ 26 */
25 var Constants = null; 27 var Constants = null;
26 28
27 /** 29 /**
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 296
295 EventType = Constants.logEventTypes; 297 EventType = Constants.logEventTypes;
296 EventTypeNames = makeInverseMap(EventType); 298 EventTypeNames = makeInverseMap(EventType);
297 EventPhase = Constants.logEventPhase; 299 EventPhase = Constants.logEventPhase;
298 EventSourceType = Constants.logSourceType; 300 EventSourceType = Constants.logSourceType;
299 EventSourceTypeNames = makeInverseMap(EventSourceType); 301 EventSourceTypeNames = makeInverseMap(EventSourceType);
300 LogLevelType = Constants.logLevelType; 302 LogLevelType = Constants.logLevelType;
301 ClientInfo = Constants.clientInfo; 303 ClientInfo = Constants.clientInfo;
302 LoadFlag = Constants.loadFlag; 304 LoadFlag = Constants.loadFlag;
303 NetError = Constants.netError; 305 NetError = Constants.netError;
306 QuicError = Constants.quicError;
307 QuicRstStreamError = Constants.quicRstStreamError;
304 AddressFamily = Constants.addressFamily; 308 AddressFamily = Constants.addressFamily;
305 LoadState = Constants.loadState; 309 LoadState = Constants.loadState;
306 310
307 timeutil.setTimeTickOffset(Constants.timeTickOffset); 311 timeutil.setTimeTickOffset(Constants.timeTickOffset);
308 }; 312 };
309 313
310 /** 314 /**
311 * Returns true if it's given a valid-looking constants object. 315 * Returns true if it's given a valid-looking constants object.
312 * @param {Object} receivedConstants The received map of constants. 316 * @param {Object} receivedConstants The received map of constants.
313 * @return {boolean} True if the |receivedConstants| object appears valid. 317 * @return {boolean} True if the |receivedConstants| object appears valid.
(...skipping 21 matching lines...) Expand all
335 * @return {string} The name of the given error. 339 * @return {string} The name of the given error.
336 */ 340 */
337 function netErrorToString(netError) { 341 function netErrorToString(netError) {
338 var str = getKeyWithValue(NetError, netError); 342 var str = getKeyWithValue(NetError, netError);
339 if (str == '?') 343 if (str == '?')
340 return str; 344 return str;
341 return 'ERR_' + str; 345 return 'ERR_' + str;
342 } 346 }
343 347
344 /** 348 /**
349 * Returns the name for quicError.
350 *
351 * Example: quicErrorToString(25) would return
eroman 2013/06/17 23:18:19 not: "would" may be too strong if the C++ code eve
Ryan Hamilton 2013/06/18 19:23:57 Heh, I simply copied the language from netErrorToS
352 * "TIMED_OUT".
353 * @param {number} quicError The QUIC error code.
354 * @return {string} The name of the given error.
355 */
356 function quicErrorToString(quicError) {
357 return getKeyWithValue(QuicError, quicError);
358 }
359
360 /**
361 * Returns the name for quicRstStreamError.
362 *
363 * Example: quicRstStreamErrorToString(3) would return
eroman 2013/06/17 23:18:19 Same comment as above.
364 * "BAD_APPLICATION_PAYLOAD".
365 * @param {number} quicRstStreamError The QUIC RST_STREAM error code.
366 * @return {string} The name of the given error.
367 */
368 function quicRstStreamErrorToString(quicRstStreamError) {
369 return getKeyWithValue(QuicRstStreamError, quicRstStreamError);
370 }
371
372 /**
345 * Returns a string representation of |family|. 373 * Returns a string representation of |family|.
346 * @param {number} family An AddressFamily 374 * @param {number} family An AddressFamily
347 * @return {string} A representation of the given family. 375 * @return {string} A representation of the given family.
348 */ 376 */
349 function addressFamilyToString(family) { 377 function addressFamilyToString(family) {
350 var str = getKeyWithValue(AddressFamily, family); 378 var str = getKeyWithValue(AddressFamily, family);
351 // All the address family start with ADDRESS_FAMILY_*. 379 // All the address family start with ADDRESS_FAMILY_*.
352 // Strip that prefix since it is redundant and only clutters the output. 380 // Strip that prefix since it is redundant and only clutters the output.
353 return str.replace(/^ADDRESS_FAMILY_/, ''); 381 return str.replace(/^ADDRESS_FAMILY_/, '');
354 } 382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698