OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 QUIC session, and | 6 * This view displays a summary of the state of each QUIC session, 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 QuicView = (function() { | 9 var QuicView = (function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 g_browser.addQuicInfoObserver(this, true); | 24 g_browser.addQuicInfoObserver(this, true); |
25 } | 25 } |
26 | 26 |
27 QuicView.TAB_ID = 'tab-handle-quic'; | 27 QuicView.TAB_ID = 'tab-handle-quic'; |
28 QuicView.TAB_NAME = 'QUIC'; | 28 QuicView.TAB_NAME = 'QUIC'; |
29 QuicView.TAB_HASH = '#quic'; | 29 QuicView.TAB_HASH = '#quic'; |
30 | 30 |
31 // IDs for special HTML elements in quic_view.html | 31 // IDs for special HTML elements in quic_view.html |
32 QuicView.MAIN_BOX_ID = 'quic-view-tab-content'; | 32 QuicView.MAIN_BOX_ID = 'quic-view-tab-content'; |
| 33 QuicView.STATUS_QUIC_ENABLED = 'quic-view-quic-enabled'; |
| 34 QuicView.STATUS_ORIGINS_TO_FORCE_QUIC_ON = |
| 35 'quic-view-origins-to-force-quic-on'; |
| 36 QuicView.STATUS_CONNECTION_OPTIONS = |
| 37 'quic-view-connection-options'; |
| 38 QuicView.STATUS_CONSISTENT_PORT_SELECTION_ENABLED = |
| 39 'quic-view-port-selection-enabled'; |
| 40 QuicView.STATUS_LOAD_SERVER_INFO_TIMEOUT_MULTIPLIER = |
| 41 'quic-view-server-info-timeout-mult'; |
| 42 QuicView.STATUS_ENABLE_CONNECTION_RACING = |
| 43 'quic-view-enable-connection-racing'; |
| 44 QuicView.STATUS_DISABLE_DISK_CACHE = |
| 45 'quic-view-disable-disk-cache'; |
| 46 QuicView.STATUS_PREFER_AES = |
| 47 'quic-view-prefer-aes'; |
| 48 QuicView.STATUS_MAX_NUM_OF_LOSSY_CONNECTIONS = |
| 49 'quic-view-max-num-lossy-connections'; |
| 50 QuicView.STATUS_PACKET_LOSS_THRESHOLD = |
| 51 'quic-view-packet-loss-threshold'; |
| 52 QuicView.STATUS_DELAY_TCP_RACE = 'quic-view-delay-tcp-race'; |
| 53 QuicView.STATUS_STORE_SERVER_CONFIGS_IN_PROPERITES_FILE = |
| 54 'quic-view-configs-in-file'; |
| 55 QuicView.STATUS_IDLE_CONNECTION_TIMEOUT_IN_SECS = |
| 56 'quic-view-connection-timeout-in-secs'; |
| 57 QuicView.STATUS_DISABLE_PRECONNECT_IF_ORTT = |
| 58 'quic-view-disable-preconnect-if-ortt'; |
| 59 QuicView.STATUS_DISABLE_QUIC_ON_TIMEOUT_WITH_OPEN_STREAMS = |
| 60 'quic-view-disable-quic-on-timeout-with-open-streams'; |
| 61 QuicView.STATUS_DYNAMICALLY_DISABLED_BULLET_POINT = |
| 62 'quic-view-dynamically-disabled-bullet-point'; |
| 63 QuicView.STATUS_DYNAMICALLY_DISABLED_SPAN = |
| 64 'quic-view-dynamically-disabled-span'; |
| 65 QuicView.SESSION_INFO_CONTENT_ID = |
| 66 'quic-view-session-info-content'; |
| 67 QuicView.SESSION_INFO_NO_CONTENT_ID = |
| 68 'quic-view-session-info-no-content'; |
| 69 QuicView.SESSION_INFO_TBODY_ID = 'quic-view-session-info-tbody'; |
33 | 70 |
34 cr.addSingletonGetter(QuicView); | 71 cr.addSingletonGetter(QuicView); |
35 | 72 |
36 QuicView.prototype = { | 73 QuicView.prototype = { |
37 // Inherit the superclass's methods. | 74 // Inherit the superclass's methods. |
38 __proto__: superClass.prototype, | 75 __proto__: superClass.prototype, |
39 | 76 |
40 onLoadLogFinish: function(data) { | 77 onLoadLogFinish: function(data) { |
41 return this.onQuicInfoChanged(data.quicInfo); | 78 return this.onQuicInfoChanged(data.quicInfo); |
42 }, | 79 }, |
43 | 80 |
44 /** | 81 /** |
45 * If there are any sessions, display a single table with | 82 * If there are any sessions, display a single table with |
46 * information on each QUIC session. Otherwise, displays "None". | 83 * information on each QUIC session. Otherwise, displays "None". |
47 */ | 84 */ |
48 onQuicInfoChanged: function(quicInfo) { | 85 onQuicInfoChanged: function(quicInfo) { |
49 if (!quicInfo) | 86 if (!quicInfo) |
50 return false; | 87 return false; |
51 // TODO(rayraymond): Update DOM without use of jstemplate. | 88 |
52 // var input = new JsEvalContext(quicInfo); | 89 $(QuicView.STATUS_QUIC_ENABLED).textContent = |
53 // jstProcess(input, $(QuicView.MAIN_BOX_ID)); | 90 !!quicInfo.quic_enabled; |
| 91 |
| 92 $(QuicView.STATUS_ORIGINS_TO_FORCE_QUIC_ON).textContent = |
| 93 quicInfo.origins_to_force_quic_on; |
| 94 |
| 95 $(QuicView.STATUS_CONNECTION_OPTIONS).textContent = |
| 96 quicInfo.connection_options; |
| 97 |
| 98 $(QuicView.STATUS_CONSISTENT_PORT_SELECTION_ENABLED). |
| 99 textContent = !!quicInfo.enable_quic_port_selection; |
| 100 |
| 101 $(QuicView.STATUS_LOAD_SERVER_INFO_TIMEOUT_MULTIPLIER). |
| 102 textContent = quicInfo.load_server_info_timeout_srtt_multiplier; |
| 103 |
| 104 $(QuicView.STATUS_ENABLE_CONNECTION_RACING).textContent = |
| 105 !!quicInfo.enable_connection_racing; |
| 106 |
| 107 $(QuicView.STATUS_DISABLE_DISK_CACHE).textContent = |
| 108 !!quicInfo.disable_disk_cache; |
| 109 |
| 110 $(QuicView.STATUS_PREFER_AES).textContent = |
| 111 !!quicInfo.prefer_aes; |
| 112 |
| 113 $(QuicView.STATUS_MAX_NUM_OF_LOSSY_CONNECTIONS).textContent = |
| 114 quicInfo.max_number_of_lossy_connections; |
| 115 |
| 116 $(QuicView.STATUS_PACKET_LOSS_THRESHOLD).textContent = |
| 117 quicInfo.packet_loss_threshold; |
| 118 |
| 119 $(QuicView.STATUS_DELAY_TCP_RACE).textContent = |
| 120 !!quicInfo.delay_tcp_race; |
| 121 |
| 122 $(QuicView.STATUS_STORE_SERVER_CONFIGS_IN_PROPERITES_FILE). |
| 123 textContent = !!quicInfo.store_server_configs_in_properties; |
| 124 |
| 125 $(QuicView.STATUS_IDLE_CONNECTION_TIMEOUT_IN_SECS).textContent = |
| 126 quicInfo.idle_connection_timeout_seconds; |
| 127 |
| 128 $(QuicView.STATUS_DISABLE_PRECONNECT_IF_ORTT).textContent = |
| 129 quicInfo.disable_preconnect_if_0rtt; |
| 130 |
| 131 $(QuicView.STATUS_DISABLE_QUIC_ON_TIMEOUT_WITH_OPEN_STREAMS). |
| 132 textContent = |
| 133 quicInfo.disable_quic_on_timeout_with_open_streams; |
| 134 |
| 135 setNodeDisplay($(QuicView.STATUS_DYNAMICALLY_DISABLED_BULLET_POINT), |
| 136 quicInfo.disabled_reason && quicInfo.disabled_reason.length > 0); |
| 137 if (quicInfo.disabled_reason && |
| 138 quicInfo.disabled_reason.length > 0) { |
| 139 $(QuicView.STATUS_DYNAMICALLY_DISABLED_SPAN).textContent = |
| 140 'QUIC dynamically disabled: ' + quicInfo.disabled_reason; |
| 141 } |
| 142 |
| 143 var sessions = quicInfo.sessions; |
| 144 |
| 145 var hasSessions = sessions && sessions.length > 0; |
| 146 |
| 147 setNodeDisplay($(QuicView.SESSION_INFO_CONTENT_ID), hasSessions); |
| 148 setNodeDisplay($(QuicView.SESSION_INFO_NO_CONTENT_ID), !hasSessions); |
| 149 |
| 150 var tbody = $(QuicView.SESSION_INFO_TBODY_ID); |
| 151 tbody.innerHTML = ''; |
| 152 |
| 153 // Fill in the sessions info table. |
| 154 for (var i = 0; i < sessions.length; ++i) { |
| 155 var q = sessions[i]; |
| 156 var tr = addNode(tbody, 'tr'); |
| 157 |
| 158 addNodeWithText(tr, 'td', q.aliases ? q.aliases.join(' ') : ''); |
| 159 addNodeWithText(tr, 'td', !!q.secure); |
| 160 addNodeWithText(tr, 'td', q.version); |
| 161 addNodeWithText(tr, 'td', q.peer_address); |
| 162 |
| 163 var connectionUIDCell = addNode(tr, 'td'); |
| 164 var a = addNode(connectionUIDCell, 'a'); |
| 165 a.href = '#events&q=type:QUIC_SESSION%20' + q.connection_id; |
| 166 a.textContent = q.connection_id; |
| 167 |
| 168 addNodeWithText(tr, 'td', q.open_streams); |
| 169 |
| 170 addNodeWithText(tr, 'td', |
| 171 q.active_streams && q.active_streams.length > 0 ? |
| 172 q.active_streams.join(', ') : 'None'); |
| 173 |
| 174 addNodeWithText(tr, 'td', q.total_streams); |
| 175 addNodeWithText(tr, 'td', q.packets_sent); |
| 176 addNodeWithText(tr, 'td', q.packets_lost); |
| 177 addNodeWithText(tr, 'td', q.packets_received); |
| 178 addNodeWithText(tr, 'td', q.connected); |
| 179 } |
| 180 |
54 return true; | 181 return true; |
55 }, | 182 }, |
56 }; | 183 }; |
57 | 184 |
58 return QuicView; | 185 return QuicView; |
59 })(); | 186 })(); |
60 | 187 |
OLD | NEW |