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

Side by Side Diff: netlog_viewer/spdy_view.js

Issue 2178423002: Bring the gh-pages branch up to date with the master branch (Closed) Base URL: https://github.com/catapult-project/catapult.git@gh-pages
Patch Set: Created 4 years, 4 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 | « netlog_viewer/spdy_view.html ('k') | no next file » | 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 * This view displays a summary of the state of each SPDY sessions, and 6 * This view displays a summary of the state of each SPDY sessions, and
7 * has links to display them in the events tab. 7 * has links to display them in the events tab.
8 */ 8 */
9 var SpdyView = (function() { 9 var SpdyView = (function() {
10 'use strict'; 10 'use strict';
(...skipping 14 matching lines...) Expand all
25 g_browser.addSpdyStatusObserver(this, true); 25 g_browser.addSpdyStatusObserver(this, true);
26 } 26 }
27 27
28 SpdyView.TAB_ID = 'tab-handle-spdy'; 28 SpdyView.TAB_ID = 'tab-handle-spdy';
29 SpdyView.TAB_NAME = 'HTTP/2'; 29 SpdyView.TAB_NAME = 'HTTP/2';
30 SpdyView.TAB_HASH = '#http2'; 30 SpdyView.TAB_HASH = '#http2';
31 31
32 // IDs for special HTML elements in spdy_view.html 32 // IDs for special HTML elements in spdy_view.html
33 SpdyView.MAIN_BOX_ID = 'spdy-view-tab-content'; 33 SpdyView.MAIN_BOX_ID = 'spdy-view-tab-content';
34 SpdyView.STATUS_ID = 'spdy-view-status'; 34 SpdyView.STATUS_ID = 'spdy-view-status';
35 SpdyView.STATUS_HTTP2_ENABLED = 'spdy-view-http2-enabled';
36 SpdyView.STATUS_SPDY31_ENABLED = 'spdy-view-spdy31-enabled';
37 SpdyView.STATUS_ALTERNATE_SERVICE = 'spdy-view-alternate-service';
38 SpdyView.STATUS_ALPN_PROTOCOLS = 'spdy-view-alpn-protocols';
39 SpdyView.STATUS_NPN_PROTOCOLS = 'spdy-view-npn-protocols';
35 SpdyView.SESSION_INFO_ID = 'spdy-view-session-info'; 40 SpdyView.SESSION_INFO_ID = 'spdy-view-session-info';
41 SpdyView.SESSION_INFO_CONTENT_ID = 'spdy-view-session-info-content';
42 SpdyView.SESSION_INFO_NO_CONTENT_ID =
43 'spdy-view-session-info-no-content';
44 SpdyView.SESSION_INFO_TBODY_ID = 'spdy-view-session-info-tbody';
36 45
37 cr.addSingletonGetter(SpdyView); 46 cr.addSingletonGetter(SpdyView);
38 47
39 SpdyView.prototype = { 48 SpdyView.prototype = {
40 // Inherit the superclass's methods. 49 // Inherit the superclass's methods.
41 __proto__: superClass.prototype, 50 __proto__: superClass.prototype,
42 51
43 onLoadLogFinish: function(data) { 52 onLoadLogFinish: function(data) {
44 return this.onSpdySessionInfoChanged(data.spdySessionInfo) && 53 return this.onSpdySessionInfoChanged(data.spdySessionInfo) &&
45 this.onSpdyStatusChanged(data.spdyStatus); 54 this.onSpdyStatusChanged(data.spdyStatus);
46 }, 55 },
47 56
48 /** 57 /**
49 * If |spdySessionInfo| contains any sessions, displays a single table with 58 * If |spdySessionInfo| contains any sessions, displays a single table with
50 * information on each SPDY session. Otherwise, displays "None". 59 * information on each SPDY session. Otherwise, displays "None".
51 */ 60 */
52 onSpdySessionInfoChanged: function(spdySessionInfo) { 61 onSpdySessionInfoChanged: function(spdySessionInfo) {
53 if (!spdySessionInfo) 62 if (!spdySessionInfo)
54 return false; 63 return false;
55 // TODO(rayraymond): Update DOM without use of jstemplate. 64
56 // var input = new JsEvalContext({ spdySessionInfo: spdySessionInfo }); 65 var hasSpdySessionInfo = spdySessionInfo && spdySessionInfo.length > 0;
57 // jstProcess(input, $(SpdyView.SESSION_INFO_ID)); 66
67 setNodeDisplay($(SpdyView.SESSION_INFO_CONTENT_ID), hasSpdySessionInfo);
68 setNodeDisplay($(SpdyView.SESSION_INFO_NO_CONTENT_ID),
69 !hasSpdySessionInfo);
70
71 var tbody = $(SpdyView.SESSION_INFO_TBODY_ID);
72 tbody.innerHTML = '';
73
74 // Fill in the sessions info table.
75 for (var i = 0; i < spdySessionInfo.length; ++i) {
76 var s = spdySessionInfo[i];
77 var tr = addNode(tbody, 'tr');
78
79 var hostCell = addNode(tr, 'td');
80 addNodeWithText(hostCell, 'span', s.host_port_pair);
81 addNodeWithText(hostCell, 'span',
82 s.aliases ? ' ' + s.aliases.join(' ') : '');
83
84 addNodeWithText(tr, 'td', s.proxy);
85
86 var idCell = addNode(tr, 'td');
87 var a = addNodeWithText(idCell, 'a', s.source_id);
88 a.href = '#events&q=id:' + s.source_id;
89
90 var kFields = ['protocol_negotiated', 'active_streams',
91 'unclaimed_pushed_streams', 'max_concurrent_streams',
92 'streams_initiated_count', 'streams_pushed_count',
93 'streams_pushed_and_claimed_count',
94 'streams_abandoned_count', 'frames_received', 'is_secure',
95 'sent_settings', 'received_settings', 'send_window_size',
96 'recv_window_size', 'unacked_recv_window_bytes', 'error'];
97
98 for (var fieldIndex = 0; fieldIndex < kFields.length; ++fieldIndex) {
99 addNodeWithText(tr, 'td', s[kFields[fieldIndex]]);
100 }
101 }
102
58 return true; 103 return true;
59 }, 104 },
60 105
61 /** 106 /**
62 * Displays information on the global SPDY status. 107 * Displays information on the global SPDY status.
63 */ 108 */
64 onSpdyStatusChanged: function(spdyStatus) { 109 onSpdyStatusChanged: function(spdyStatus) {
65 if (!spdyStatus) 110 if (!spdyStatus)
66 return false; 111 return false;
67 // TODO(rayraymond): Update DOM without use of jstemplate. 112
68 // var input = new JsEvalContext(spdyStatus); 113 $(SpdyView.STATUS_HTTP2_ENABLED).textContent =
69 // jstProcess(input, $(SpdyView.STATUS_ID)); 114 (spdyStatus.enable_http2 == undefined ?
115 spdyStatus.spdy_enabled : spdyStatus.enable_http2);
116
117 $(SpdyView.STATUS_SPDY31_ENABLED).textContent =
118 (spdyStatus.enable_spdy31 == undefined ?
119 spdyStatus.spdy_enabled : spdyStatus.enable_spdy31);
120
121 $(SpdyView.STATUS_ALTERNATE_SERVICE).textContent =
122 (spdyStatus.use_alternative_services == undefined ?
123 spdyStatus.use_alternate_protocols :
124 spdyStatus.use_alternative_services);
125
126 $(SpdyView.STATUS_ALPN_PROTOCOLS).textContent =
127 (spdyStatus.alpn_protos || spdyStatus.next_protos);
128
129 $(SpdyView.STATUS_NPN_PROTOCOLS).textContent =
130 (spdyStatus.npn_protos || spdyStatus.next_protos);
131
70 return true; 132 return true;
71 } 133 }
72 }; 134 };
73 135
74 return SpdyView; 136 return SpdyView;
75 })(); 137 })();
76 138
OLDNEW
« no previous file with comments | « netlog_viewer/spdy_view.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698