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

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

Issue 11696010: Integrate QUIC info into net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
eroman 2013/01/04 00:16:14 2013 now :)
Ryan Hamilton 2013/01/04 02:56:05 Hah! Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * This view displays a summary of the state of each QUIC sessions, and
eroman 2013/01/04 00:16:14 something doesn't sound right here...
Ryan Hamilton 2013/01/04 02:56:05 Done.
7 * has links to display them in the events tab.
8 */
9 var QuicView = (function() {
10 'use strict';
11
12 // We inherit from DivView.
13 var superClass = DivView;
14
15 /**
16 * @constructor
17 */
18 function QuicView() {
19 assertFirstConstructorCall(QuicView);
20
21 // Call superclass's constructor.
22 superClass.call(this, QuicView.MAIN_BOX_ID);
23
24 g_browser.addQuicInfoObserver(this, true);
25
26 this.quicEnabledSpan_ = $(QuicView.ENABLED_SPAN_ID);
27 this.quicForcePortSpan_ = $(QuicView.FORCE_PORT_SPAN_ID);
28
29 this.quicSessionNoneSpan_ = $(QuicView.SESSION_NONE_SPAN_ID);
30 this.quicSessionLinkSpan_ = $(QuicView.SESSION_LINK_SPAN_ID);
31 this.quicSessionDiv_ = $(QuicView.SESSION_DIV_ID);
32 }
33
34 // ID for special HTML element in category_tabs.html
35 QuicView.TAB_HANDLE_ID = 'tab-handle-quic';
36
37 // IDs for special HTML elements in quic_view.html
38 QuicView.MAIN_BOX_ID = 'quic-view-tab-content';
39 QuicView.ENABLED_SPAN_ID = 'quic-view-enabled-span';
40 QuicView.FORCE_PORT_SPAN_ID = 'quic-view-force-port-span';
41 QuicView.SESSION_NONE_SPAN_ID = 'quic-view-session-none-span';
42 QuicView.SESSION_LINK_SPAN_ID = 'quic-view-session-link-span';
43 QuicView.SESSION_DIV_ID = 'quic-view-session-div';
44
45 cr.addSingletonGetter(QuicView);
46
47 QuicView.prototype = {
48 // Inherit the superclass's methods.
49 __proto__: superClass.prototype,
50
51 onLoadLogFinish: function(data) {
52 return this.onQuicInfoChanged(data.quicInfo);
53 },
54
55 /**
56 * If |quicInfo| there are any sessions, display a single table with
eroman 2013/01/04 00:16:14 doesn't sound right.
Ryan Hamilton 2013/01/04 02:56:05 Done.
57 * information on each QUIC session. Otherwise, displays "None".
58 */
59 onQuicInfoChanged: function(quicInfo) {
60 this.quicSessionDiv_.innerHTML = '';
61
62 var hasNoSession =
63 (quicInfo == null || quicInfo.sessions == null ||
eroman 2013/01/04 00:16:14 Rather than testing null, i suggest doing a boolea
Ryan Hamilton 2013/01/04 02:56:05 Done.
64 quicInfo.sessions.length == 0);
65 setNodeDisplay(this.quicSessionNoneSpan_, hasNoSession);
66 setNodeDisplay(this.quicSessionLinkSpan_, !hasNoSession);
67
68 // Only want to be hide the tab if there's no data. In the case of having
69 // data but no sessions, still show the tab.
70 if (!quicInfo)
71 return false;
72
73 this.quicEnabledSpan_.textContent = quicInfo.quic_enabled;
74 this.quicForcePortSpan_.textContent =
75 quicInfo.origin_port_to_force_quic_on;
76
77 if (!hasNoSession) {
78 var tablePrinter = createSessionTablePrinter(quicInfo.sessions);
79 tablePrinter.toHTML(this.quicSessionDiv_, 'styled-table');
80 }
81
82 return true;
83 },
84 };
85
86 /**
87 * Creates a table printer to print out the state of list of QUIC sessions.
88 */
89 function createSessionTablePrinter(quicSessions) {
90 var tablePrinter = new TablePrinter();
91
92 tablePrinter.addHeaderCell('Host');
93 tablePrinter.addHeaderCell('Peer address');
94 tablePrinter.addHeaderCell('GUID');
95 tablePrinter.addHeaderCell('Active streams');
96
97 for (var i = 0; i < quicSessions.length; i++) {
98 var session = quicSessions[i];
99 tablePrinter.addRow();
100
101 var host = session.host_port_pair;
102 if (session.aliases)
103 host += ' ' + session.aliases.join(' ');
104 tablePrinter.addCell(host);
105
106 tablePrinter.addCell(session.peer_address);
107 tablePrinter.addCell(session.guid);
108 tablePrinter.addCell(session.open_streams);
109 }
110 return tablePrinter;
111 }
112
113 return QuicView;
114 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698