diff options
Diffstat (limited to 'chrome/browser/resources/net_internals')
10 files changed, 228 insertions, 2 deletions
diff --git a/chrome/browser/resources/net_internals/browser_bridge.js b/chrome/browser/resources/net_internals/browser_bridge.js index 8c65479..969df1c 100644 --- a/chrome/browser/resources/net_internals/browser_bridge.js +++ b/chrome/browser/resources/net_internals/browser_bridge.js @@ -61,6 +61,9 @@ var BrowserBridge = (function() { this.pollableDataHelpers_.prerenderInfo = new PollableDataHelper('onPrerenderInfoChanged', this.sendGetPrerenderInfo.bind(this)); + this.pollableDataHelpers_.httpPipeliningStatus = + new PollableDataHelper('onHttpPipeliningStatusChanged', + this.sendGetHttpPipeliningStatus.bind(this)); // NetLog entries are all sent to the |SourceTracker|, which both tracks // them and manages its own observer list. @@ -234,6 +237,10 @@ var BrowserBridge = (function() { this.send('importONCFile', [fileContent, passcode]); }, + sendGetHttpPipeliningStatus: function() { + this.send('getHttpPipeliningStatus'); + }, + //-------------------------------------------------------------------------- // Messages received from the browser. //-------------------------------------------------------------------------- @@ -341,6 +348,11 @@ var BrowserBridge = (function() { this.pollableDataHelpers_.prerenderInfo.update(prerenderInfo); }, + receivedHttpPipeliningStatus: function(httpPipeliningStatus) { + this.pollableDataHelpers_.httpPipeliningStatus.update( + httpPipeliningStatus); + }, + //-------------------------------------------------------------------------- /** @@ -548,6 +560,17 @@ var BrowserBridge = (function() { }, /** + * Adds a listener of HTTP pipelining status. |observer| will be called + * back when data is received, through: + * + * observer.onHttpPipelineStatusChanged(httpPipeliningStatus) + */ + addHttpPipeliningStatusObserver: function(observer, ignoreWhenUnchanged) { + this.pollableDataHelpers_.httpPipeliningStatus.addObserver( + observer, ignoreWhenUnchanged); + }, + + /** * If |force| is true, calls all startUpdate functions. Otherwise, just * runs updates with active observers. */ diff --git a/chrome/browser/resources/net_internals/category_tabs.html b/chrome/browser/resources/net_internals/category_tabs.html index e617a20..6025cf7 100644 --- a/chrome/browser/resources/net_internals/category_tabs.html +++ b/chrome/browser/resources/net_internals/category_tabs.html @@ -9,6 +9,7 @@ <a href="#dns" id=tab-handle-dns>DNS</a> <a href="#sockets" id=tab-handle-sockets>Sockets</a> <a href="#spdy" id=tab-handle-spdy>SPDY</a> + <a href="#httpPipeline" id=tab-handle-http-pipeline>HTTP Pipelining</a> <a href="#httpCache" id=tab-handle-http-cache>HTTP Cache</a> <a href="#httpThrottling" id=tab-handle-http-throttling>HTTP Throttling</a> <!-- Tab is only shown on Windows --> diff --git a/chrome/browser/resources/net_internals/http_pipeline_view.html b/chrome/browser/resources/net_internals/http_pipeline_view.html new file mode 100644 index 0000000..d2991ad --- /dev/null +++ b/chrome/browser/resources/net_internals/http_pipeline_view.html @@ -0,0 +1,23 @@ +<div id=http-pipeline-view-tab-content> + <h4>HTTP Pipelining Status</h4> + <ul> + <li>HTTP Pipelining Enabled: <span id=http-pipeline-view-enabled-span>????</span></li> + </ul> + + <h4>HTTP Pipelined Connections</h4> + <!-- Only one of these two are shown --> + <span id=http-pipeline-view-connections-none-span>None</span> + <span id=http-pipeline-view-connections-link-span style="display: none;"> + <a href="#events&q=type:HTTP_PIPELINED_CONNECTION%20is:active">View live HTTP pipelined connections</a> + </span> + <p> + <div id=http-pipeline-view-connections-div> + </div> + </p> + + <h4>Known Hosts</h4> + <p> + <div id=http-pipeline-view-known-hosts-div> + </div> + </p> +</div> diff --git a/chrome/browser/resources/net_internals/http_pipeline_view.js b/chrome/browser/resources/net_internals/http_pipeline_view.js new file mode 100644 index 0000000..39652be --- /dev/null +++ b/chrome/browser/resources/net_internals/http_pipeline_view.js @@ -0,0 +1,169 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * This view displays a summary of the state of each HTTP pipelined connection, + * and has links to display them in the events tab. + */ +var HttpPipelineView = (function() { + 'use strict'; + + // We inherit from DivView. + var superClass = DivView; + + /** + * @constructor + */ + function HttpPipelineView() { + assertFirstConstructorCall(HttpPipelineView); + + // Call superclass's constructor. + superClass.call(this, HttpPipelineView.MAIN_BOX_ID); + + g_browser.addHttpPipeliningStatusObserver(this, true); + + this.httpPipeliningEnabledSpan_ = $(HttpPipelineView.ENABLED_SPAN_ID); + this.httpPipelineConnectionsNoneSpan_ = + $(HttpPipelineView.CONNECTIONS_NONE_SPAN_ID); + this.httpPipelineConnectionsLinkSpan_ = + $(HttpPipelineView.CONNECTIONS_LINK_SPAN_ID); + this.httpPipelineConnectionsDiv_ = $(HttpPipelineView.CONNECTIONS_DIV_ID); + this.httpPipelineKnownHostsDiv_ = $(HttpPipelineView.KNOWN_HOSTS_DIV_ID); + } + + // ID for special HTML element in category_tabs.html + HttpPipelineView.TAB_HANDLE_ID = 'tab-handle-http-pipeline'; + + // IDs for special HTML elements in http_pipeline_view.html + HttpPipelineView.MAIN_BOX_ID = 'http-pipeline-view-tab-content'; + HttpPipelineView.ENABLED_SPAN_ID = 'http-pipeline-view-enabled-span'; + HttpPipelineView.CONNECTIONS_NONE_SPAN_ID = + 'http-pipeline-view-connections-none-span'; + HttpPipelineView.CONNECTIONS_LINK_SPAN_ID = + 'http-pipeline-view-connections-link-span'; + HttpPipelineView.CONNECTIONS_DIV_ID = 'http-pipeline-view-connections-div'; + HttpPipelineView.KNOWN_HOSTS_DIV_ID = 'http-pipeline-view-known-hosts-div'; + + cr.addSingletonGetter(HttpPipelineView); + + HttpPipelineView.prototype = { + // Inherit the superclass's methods. + __proto__: superClass.prototype, + + onLoadLogFinish: function(data) { + return this.onHttpPipeliningStatusChanged(data.httpPipeliningStatus); + }, + + /** + * Displays information on the global HTTP pipelining status. + */ + onHttpPipeliningStatusChanged: function(httpPipelineStatus) { + return this.displayHttpPipeliningEnabled(httpPipelineStatus) && + this.displayHttpPipelinedConnectionInfo( + httpPipelineStatus.pipelined_connection_info) && + this.displayHttpPipeliningKnownHosts( + httpPipelineStatus.pipelined_host_info); + }, + + displayHttpPipeliningEnabled: function(httpPipelineStatus) { + this.httpPipeliningEnabledSpan_.textContent = + httpPipelineStatus.pipelining_enabled; + + return httpPipelineStatus.pipelining_enabled; + }, + + /** + * If |httpPipelinedConnectionInfo| is not empty, then display information + * on each HTTP pipelined connection. Otherwise, displays "None". + */ + displayHttpPipelinedConnectionInfo: + function(httpPipelinedConnectionInfo) { + this.httpPipelineConnectionsDiv_.innerHTML = ''; + + var hasInfo = (httpPipelinedConnectionInfo != null && + httpPipelinedConnectionInfo.length > 0); + setNodeDisplay(this.httpPipelineConnectionsNoneSpan_, !hasInfo); + setNodeDisplay(this.httpPipelineConnectionsLinkSpan_, hasInfo); + + if (hasInfo) { + var tablePrinter = createConnectionTablePrinter( + httpPipelinedConnectionInfo); + tablePrinter.toHTML(this.httpPipelineConnectionsDiv_, 'styledTable'); + } + + return true; + }, + + /** + * If |httpPipeliningKnownHosts| is not empty, displays a single table + * with information on known pipelining hosts. Otherwise, displays "None". + */ + displayHttpPipeliningKnownHosts: function(httpPipeliningKnownHosts) { + this.httpPipelineKnownHostsDiv_.innerHTML = ''; + + if (httpPipeliningKnownHosts != null && + httpPipeliningKnownHosts.length > 0) { + var tabPrinter = createKnownHostsTablePrinter(httpPipeliningKnownHosts); + tabPrinter.toHTML( + this.httpPipelineKnownHostsDiv_, 'styledTable'); + } else { + this.httpPipelineKnownHostsDiv_.innerHTML = 'None'; + } + return true; + } + }; + + /** + * Creates a table printer to print out the state of a list of HTTP pipelined + * connections. + */ + function createConnectionTablePrinter(httpPipelinedConnectionInfo) { + var tablePrinter = new TablePrinter(); + tablePrinter.addHeaderCell('Host'); + tablePrinter.addHeaderCell('Depth'); + tablePrinter.addHeaderCell('Capacity'); + tablePrinter.addHeaderCell('Usable'); + tablePrinter.addHeaderCell('Active'); + tablePrinter.addHeaderCell('ID'); + + for (var i = 0; i < httpPipelinedConnectionInfo.length; i++) { + var host = httpPipelinedConnectionInfo[i]; + for (var j = 0; j < host.length; j++) { + var connection = host[j]; + tablePrinter.addRow(); + + tablePrinter.addCell(connection.host); + tablePrinter.addCell(connection.depth); + tablePrinter.addCell(connection.capacity); + tablePrinter.addCell(connection.usable); + tablePrinter.addCell(connection.active); + + var idCell = tablePrinter.addCell(connection.source_id); + idCell.link = '#events&q=id:' + connection.source_id; + } + } + return tablePrinter; + } + + /** + * Creates a table printer to print out the list of known hosts and whether or + * not they support pipelining. + */ + function createKnownHostsTablePrinter(httpPipeliningKnownHosts) { + var tablePrinter = new TablePrinter(); + tablePrinter.addHeaderCell('Host'); + tablePrinter.addHeaderCell('Pipelining Capalibility'); + + for (var i = 0; i < httpPipeliningKnownHosts.length; i++) { + var entry = httpPipeliningKnownHosts[i]; + tablePrinter.addRow(); + + tablePrinter.addCell(entry.host); + tablePrinter.addCell(entry.capability); + } + return tablePrinter; + } + + return HttpPipelineView; +})(); diff --git a/chrome/browser/resources/net_internals/index.html b/chrome/browser/resources/net_internals/index.html index 33b6c87f..6cf099a 100644 --- a/chrome/browser/resources/net_internals/index.html +++ b/chrome/browser/resources/net_internals/index.html @@ -25,6 +25,7 @@ found in the LICENSE file. <include src="dns_view.html"/> <include src="sockets_view.html"/> <include src="spdy_view.html"/> + <include src="http_pipeline_view.html"/> <include src="http_cache_view.html"/> <include src="http_throttling_view.html"/> <include src="prerender_view.html"/> diff --git a/chrome/browser/resources/net_internals/index.js b/chrome/browser/resources/net_internals/index.js index 2954b1f..b002ee6e 100644 --- a/chrome/browser/resources/net_internals/index.js +++ b/chrome/browser/resources/net_internals/index.js @@ -40,6 +40,7 @@ <include src="logs_view.js"/> <include src="prerender_view.js"/> <include src="chromeos_view.js"/> +<include src="http_pipeline_view.js"/> document.addEventListener('DOMContentLoaded', function() { MainView.getInstance(); // from main.js diff --git a/chrome/browser/resources/net_internals/main.css b/chrome/browser/resources/net_internals/main.css index 2ebc737..655e27b 100644 --- a/chrome/browser/resources/net_internals/main.css +++ b/chrome/browser/resources/net_internals/main.css @@ -56,6 +56,7 @@ body { #http-throttling-view-tab-content, #logs-view-tab-content, #prerender-view-tab-content, +#http-pipeline-view-tab-content, #chromeos-view-tab-content { overflow: auto; padding: 10px; diff --git a/chrome/browser/resources/net_internals/main.js b/chrome/browser/resources/net_internals/main.js index 293399a..034abf2 100644 --- a/chrome/browser/resources/net_internals/main.js +++ b/chrome/browser/resources/net_internals/main.js @@ -90,6 +90,8 @@ var MainView = (function() { tabs.addTab(SocketsView.TAB_HANDLE_ID, SocketsView.getInstance(), false, true); tabs.addTab(SpdyView.TAB_HANDLE_ID, SpdyView.getInstance(), false, true); + tabs.addTab(HttpPipelineView.TAB_HANDLE_ID, HttpPipelineView.getInstance(), + false, true); tabs.addTab(HttpCacheView.TAB_HANDLE_ID, HttpCacheView.getInstance(), false, true); tabs.addTab(HttpThrottlingView.TAB_HANDLE_ID, diff --git a/chrome/browser/resources/net_internals/source_entry.js b/chrome/browser/resources/net_internals/source_entry.js index e80e3b5..1a244db 100644 --- a/chrome/browser/resources/net_internals/source_entry.js +++ b/chrome/browser/resources/net_internals/source_entry.js @@ -98,6 +98,10 @@ var SourceEntry = (function() { if (e.params.host) this.description_ = e.params.host + ' (' + e.params.proxy + ')'; break; + case LogSourceType.HTTP_PIPELINED_CONNECTION: + if (e.params.host_and_port) + this.description_ = e.params.host_and_port; + break; case LogSourceType.SOCKET: // Use description of parent source, if any. if (e.params.source_dependency != undefined) { diff --git a/chrome/browser/resources/net_internals/spdy_view.html b/chrome/browser/resources/net_internals/spdy_view.html index 57d3553..c4dcef5 100644 --- a/chrome/browser/resources/net_internals/spdy_view.html +++ b/chrome/browser/resources/net_internals/spdy_view.html @@ -12,7 +12,7 @@ <!-- Only one of these two are shown --> <span id=spdy-view-session-none-span>None</span> <span id=spdy-view-session-link-span style="display: none;"> - <a href='#events&q=type:SPDY_SESSION%20is:active'>View live SPDY sessions</a> + <a href="#events&q=type:SPDY_SESSION%20is:active">View live SPDY sessions</a> </span> <p> <div id=spdy-view-session-div> @@ -20,7 +20,8 @@ </p> <h4>Alternate Protocol Mappings</h4> - <p /> + <p> <div id=spdy-view-alternate-protocol-mappings-div> </div> + </p> </div> |