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

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

Issue 19286002: Remove interface probing for IPv6 support from HostResolverImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make --enable-ipv6 disable probing. Created 7 years, 5 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
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 information on the host resolver: 6 * This view displays information on the host resolver:
7 * 7 *
8 * - Shows the default address family. 8 * - Shows the default address family.
9 * - Has a button to enable IPv6, if it is disabled. 9 * - Has a button to enable IPv6, if it is disabled.
10 * - Shows the current host cache contents. 10 * - Shows the current host cache contents.
(...skipping 16 matching lines...) Expand all
27 * @constructor 27 * @constructor
28 */ 28 */
29 function DnsView() { 29 function DnsView() {
30 assertFirstConstructorCall(DnsView); 30 assertFirstConstructorCall(DnsView);
31 31
32 // Call superclass's constructor. 32 // Call superclass's constructor.
33 superClass.call(this, DnsView.MAIN_BOX_ID); 33 superClass.call(this, DnsView.MAIN_BOX_ID);
34 34
35 $(DnsView.ENABLE_IPV6_BUTTON_ID).onclick = 35 $(DnsView.ENABLE_IPV6_BUTTON_ID).onclick =
36 g_browser.enableIPv6.bind(g_browser); 36 g_browser.enableIPv6.bind(g_browser);
37 $(DnsView.IPV6_PROBE_BUTTON_ID).onclick = this.runIPv6Probe_.bind(this);
38 $(DnsView.CLEAR_CACHE_BUTTON_ID).onclick = 37 $(DnsView.CLEAR_CACHE_BUTTON_ID).onclick =
39 g_browser.sendClearHostResolverCache.bind(g_browser); 38 g_browser.sendClearHostResolverCache.bind(g_browser);
40 39
41 // Used to track IPv6 probes.
42 EventsTracker.getInstance().addLogEntryObserver(this);
43 // ID of most recently started IPv6 probe job. Once the job completes,
44 // set back to -1.
45 this.ipv6ProbeJobSourceId_ = -1;
46
47 // Register to receive changes to the host resolver info. 40 // Register to receive changes to the host resolver info.
48 g_browser.addHostResolverInfoObserver(this, false); 41 g_browser.addHostResolverInfoObserver(this, false);
49 } 42 }
50 43
51 DnsView.TAB_ID = 'tab-handle-dns'; 44 DnsView.TAB_ID = 'tab-handle-dns';
52 DnsView.TAB_NAME = 'DNS'; 45 DnsView.TAB_NAME = 'DNS';
53 DnsView.TAB_HASH = '#dns'; 46 DnsView.TAB_HASH = '#dns';
54 47
55 // IDs for special HTML elements in dns_view.html 48 // IDs for special HTML elements in dns_view.html
56 DnsView.MAIN_BOX_ID = 'dns-view-tab-content'; 49 DnsView.MAIN_BOX_ID = 'dns-view-tab-content';
57 DnsView.DEFAULT_FAMILY_SPAN_ID = 'dns-view-default-family'; 50 DnsView.DEFAULT_FAMILY_SPAN_ID = 'dns-view-default-family';
58 DnsView.IPV6_DISABLED_SPAN_ID = 'dns-view-ipv6-disabled'; 51 DnsView.IPV6_DISABLED_SPAN_ID = 'dns-view-ipv6-disabled';
59 DnsView.ENABLE_IPV6_BUTTON_ID = 'dns-view-enable-ipv6'; 52 DnsView.ENABLE_IPV6_BUTTON_ID = 'dns-view-enable-ipv6';
60 53
61 DnsView.IPV6_PROBE_RUNNING_SPAN_ID = 'dns-view-ipv6-probe-running';
62 DnsView.IPV6_PROBE_COMPLETE_SPAN_ID = 'dns-view-ipv6-probe-complete';
63 DnsView.IPV6_PROBE_BUTTON_ID = 'dns-view-run-ipv6-probe';
64
65 DnsView.INTERNAL_DNS_ENABLED_SPAN_ID = 'dns-view-internal-dns-enabled'; 54 DnsView.INTERNAL_DNS_ENABLED_SPAN_ID = 'dns-view-internal-dns-enabled';
66 DnsView.INTERNAL_DNS_INVALID_CONFIG_SPAN_ID = 55 DnsView.INTERNAL_DNS_INVALID_CONFIG_SPAN_ID =
67 'dns-view-internal-dns-invalid-config'; 56 'dns-view-internal-dns-invalid-config';
68 DnsView.INTERNAL_DNS_CONFIG_TBODY_ID = 'dns-view-internal-dns-config-tbody'; 57 DnsView.INTERNAL_DNS_CONFIG_TBODY_ID = 'dns-view-internal-dns-config-tbody';
69 58
70 DnsView.CLEAR_CACHE_BUTTON_ID = 'dns-view-clear-cache'; 59 DnsView.CLEAR_CACHE_BUTTON_ID = 'dns-view-clear-cache';
71 DnsView.CAPACITY_SPAN_ID = 'dns-view-cache-capacity'; 60 DnsView.CAPACITY_SPAN_ID = 'dns-view-cache-capacity';
72 61
73 DnsView.ACTIVE_SPAN_ID = 'dns-view-cache-active'; 62 DnsView.ACTIVE_SPAN_ID = 'dns-view-cache-active';
74 DnsView.EXPIRED_SPAN_ID = 'dns-view-cache-expired'; 63 DnsView.EXPIRED_SPAN_ID = 'dns-view-cache-expired';
75 DnsView.CACHE_TBODY_ID = 'dns-view-cache-tbody'; 64 DnsView.CACHE_TBODY_ID = 'dns-view-cache-tbody';
76 65
77 cr.addSingletonGetter(DnsView); 66 cr.addSingletonGetter(DnsView);
78 67
79 DnsView.prototype = { 68 DnsView.prototype = {
80 // Inherit the superclass's methods. 69 // Inherit the superclass's methods.
81 __proto__: superClass.prototype, 70 __proto__: superClass.prototype,
82 71
83 onLoadLogStart: function(polledData, tabData, logDump) {
84 // Clear information on whether or not an IPv6 probe is running. Needs
85 // to be done before loading the events.
86 this.setIPv6ProbeJobLookupRunning_(false, -1);
87 },
88
89 onLoadLogFinish: function(data) { 72 onLoadLogFinish: function(data) {
90 return this.onHostResolverInfoChanged(data.hostResolverInfo); 73 return this.onHostResolverInfoChanged(data.hostResolverInfo);
91 }, 74 },
92 75
93 onHostResolverInfoChanged: function(hostResolverInfo) { 76 onHostResolverInfoChanged: function(hostResolverInfo) {
94 // Clear the existing values. 77 // Clear the existing values.
95 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerHTML = ''; 78 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerHTML = '';
96 $(DnsView.CAPACITY_SPAN_ID).innerHTML = ''; 79 $(DnsView.CAPACITY_SPAN_ID).innerHTML = '';
97 $(DnsView.CACHE_TBODY_ID).innerHTML = ''; 80 $(DnsView.CACHE_TBODY_ID).innerHTML = '';
98 $(DnsView.ACTIVE_SPAN_ID).innerHTML = '0'; 81 $(DnsView.ACTIVE_SPAN_ID).innerHTML = '0';
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 expiredSpan.classList.add('warning-text'); 141 expiredSpan.classList.add('warning-text');
159 addTextNode(expiredSpan, ' [Expired]'); 142 addTextNode(expiredSpan, ' [Expired]');
160 } 143 }
161 } 144 }
162 145
163 $(DnsView.ACTIVE_SPAN_ID).innerText = 146 $(DnsView.ACTIVE_SPAN_ID).innerText =
164 hostResolverCache.entries.length - expiredEntries; 147 hostResolverCache.entries.length - expiredEntries;
165 $(DnsView.EXPIRED_SPAN_ID).innerText = expiredEntries; 148 $(DnsView.EXPIRED_SPAN_ID).innerText = expiredEntries;
166 return true; 149 return true;
167 }, 150 },
168
169 /**
170 * Must be called whenever an IPv6 probe job starts or stops running.
171 * @param {bool} running True if a probe job is running.
172 * @param {sourceId} sourceId Source ID of the running probe job, if there
173 * is one. -1 if |running| is false or we don't yet have the ID.
174 */
175 setIPv6ProbeJobLookupRunning_: function(running, sourceId) {
176 setNodeDisplay($(DnsView.IPV6_PROBE_RUNNING_SPAN_ID), running);
177 setNodeDisplay($(DnsView.IPV6_PROBE_COMPLETE_SPAN_ID), !running);
178 this.ipv6ProbeJobSourceId_ = sourceId;
179 },
180
181 /**
182 * Triggers a new IPv6 probe and displays the probe running message.
183 */
184 runIPv6Probe_: function() {
185 // Since there's no source ID yet, have to just use -1. We'll get the
186 // ID when we see the start event for the probe.
187 this.setIPv6ProbeJobLookupRunning_(true, -1);
188 g_browser.sendRunIPv6Probe();
189 },
190
191 onReceivedLogEntries: function(logEntries) {
192 for (var i = 0; i < logEntries.length; ++i) {
193 if (logEntries[i].source.type != EventSourceType.IPV6_PROBE_JOB ||
194 logEntries[i].type != EventType.IPV6_PROBE_RUNNING) {
195 continue;
196 }
197
198 // For IPV6_PROBE_JOB events, update the display depending on whether or
199 // not a probe job is running. Only track the most recently started
200 // probe job, as it will cancel any older jobs.
201 if (logEntries[i].phase == EventPhase.PHASE_BEGIN) {
202 this.setIPv6ProbeJobLookupRunning_(true, logEntries[i].source.id);
203 } else if (logEntries[i].source.id == this.ipv6ProbeJobSourceId_) {
204 this.setIPv6ProbeJobLookupRunning_(false, -1);
205 g_browser.sendGetHostResolverInfo();
206 }
207 }
208 },
209
210 /**
211 * Since the only thing that matters is the source ID of the active probe
212 * job, which clearing events doesn't change, do nothing.
213 */
214 onAllLogEntriesDeleted: function() {
215 },
216 }; 151 };
217 152
218 /** 153 /**
219 * Displays information corresponding to the current async DNS configuration. 154 * Displays information corresponding to the current async DNS configuration.
220 * @param {Object} hostResolverInfo The host resolver information. 155 * @param {Object} hostResolverInfo The host resolver information.
221 */ 156 */
222 function displayAsyncDnsConfig_(hostResolverInfo) { 157 function displayAsyncDnsConfig_(hostResolverInfo) {
223 // Clear the table. 158 // Clear the table.
224 $(DnsView.INTERNAL_DNS_CONFIG_TBODY_ID).innerHTML = ''; 159 $(DnsView.INTERNAL_DNS_CONFIG_TBODY_ID).innerHTML = '';
225 160
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 * @param {DomNode} node The parent node. 204 * @param {DomNode} node The parent node.
270 * @param {Array.<string>} list List of strings to add to the node. 205 * @param {Array.<string>} list List of strings to add to the node.
271 */ 206 */
272 function addListToNode_(node, list) { 207 function addListToNode_(node, list) {
273 for (var i = 0; i < list.length; ++i) 208 for (var i = 0; i < list.length; ++i)
274 addNodeWithText(node, 'div', list[i]); 209 addNodeWithText(node, 'div', list[i]);
275 } 210 }
276 211
277 return DnsView; 212 return DnsView;
278 })(); 213 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/dns_view.html ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698