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

Unified Diff: chrome/browser/resources/net_internals/main.js

Issue 1558027: Add the host resolver cache to the new net internals page. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync with fragment changes Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/net_internals/index.html ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/main.js
===================================================================
--- chrome/browser/resources/net_internals/main.js (revision 43905)
+++ chrome/browser/resources/net_internals/main.js (working copy)
@@ -50,6 +50,14 @@
"badProxiesTableBody",
"clearBadProxies");
+ // Create a view which will display information on the host resolver.
+ var dnsView = new DnsView("dnsTabContent",
+ "hostResolverCacheTbody",
+ "clearHostResolverCache",
+ "hostResolverCacheCapacity",
+ "hostResolverCacheTTLSuccess",
+ "hostResolverCacheTTLFailure");
+
// Create a view which lets you tab between the different sub-views.
var categoryTabSwitcher =
new TabSwitcherView(new DivView('categoryTabHandles'));
@@ -57,7 +65,7 @@
// Populate the main tabs.
categoryTabSwitcher.addTab('requestsTab', requestsView, false);
categoryTabSwitcher.addTab('proxyTab', proxyView, false);
- categoryTabSwitcher.addTab('dnsTab', new DivView('dnsTabContent'), false);
+ categoryTabSwitcher.addTab('dnsTab', dnsView, false);
categoryTabSwitcher.addTab('socketsTab', new DivView('socketsTabContent'),
false);
categoryTabSwitcher.addTab('httpCacheTab',
@@ -104,10 +112,11 @@
this.logObservers_ = [];
this.proxySettingsObservers_ = [];
this.badProxiesObservers_ = [];
+ this.hostResolverCacheObservers_ = [];
- // Map from observer method name (i.e. 'onProxySettingsChanged', 'onBadProxiesChanged')
- // to the previously received data for that type. Used to tell if the data has
- // actually changed since we last polled it.
+ // Map from observer method name (i.e. 'onProxySettingsChanged',
+ // 'onBadProxiesChanged') to the previously received data for that type. Used
+ // to tell if the data has actually changed since we last polled it.
this.prevPollData_ = {};
}
@@ -144,10 +153,19 @@
chrome.send('getBadProxies');
};
+BrowserBridge.prototype.sendGetHostResolverCache = function() {
+ // The browser will call receivedHostResolverCache on completion.
+ chrome.send('getHostResolverCache');
+};
+
BrowserBridge.prototype.sendClearBadProxies = function() {
chrome.send('clearBadProxies');
};
+BrowserBridge.prototype.sendClearHostResolverCache = function() {
+ chrome.send('clearHostResolverCache');
+};
+
//------------------------------------------------------------------------------
// Messages received from the browser
//------------------------------------------------------------------------------
@@ -161,11 +179,13 @@
LogEventType = constantsMap;
};
-BrowserBridge.prototype.receivedLogEventPhaseConstants = function(constantsMap) {
+BrowserBridge.prototype.receivedLogEventPhaseConstants =
+function(constantsMap) {
LogEventPhase = constantsMap;
};
-BrowserBridge.prototype.receivedLogSourceTypeConstants = function(constantsMap) {
+BrowserBridge.prototype.receivedLogSourceTypeConstants =
+function(constantsMap) {
LogSourceType = constantsMap;
};
@@ -187,6 +207,13 @@
this.badProxiesObservers_, 'onBadProxiesChanged', badProxies);
};
+BrowserBridge.prototype.receivedHostResolverCache =
+function(hostResolverCache) {
+ this.dispatchToObserversFromPoll_(
+ this.hostResolverCacheObservers_, 'onHostResolverCacheChanged',
+ hostResolverCache);
+};
+
//------------------------------------------------------------------------------
/**
@@ -228,6 +255,16 @@
};
/**
+ * Adds a listener of the host resolver cache. |observer| will be called back
+ * when data is received, through:
+ *
+ * observer.onHostResolverCacheChanged(hostResolverCache)
+ */
+BrowserBridge.prototype.addHostResolverCacheObserver = function(observer) {
+ this.hostResolverCacheObservers_.push(observer);
+};
+
+/**
* The browser gives us times in terms of "time ticks" in milliseconds.
* This function converts the tick count to a Date() object.
*
@@ -244,8 +281,12 @@
};
BrowserBridge.prototype.doPolling_ = function() {
+ // TODO(eroman): Optimize this by using a separate polling frequency for the
+ // data consumed by the currently active view. Everything else can be on a low
+ // frequency poll since it won't impact the display.
this.sendGetProxySettings();
this.sendGetBadProxies();
+ this.sendGetHostResolverCache();
};
/**
« no previous file with comments | « chrome/browser/resources/net_internals/index.html ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698