| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 __proto__: superClass.prototype, | 64 __proto__: superClass.prototype, |
| 65 | 65 |
| 66 onLoadLogFinish: function(data) { | 66 onLoadLogFinish: function(data) { |
| 67 return this.onHostResolverInfoChanged(data.hostResolverInfo); | 67 return this.onHostResolverInfoChanged(data.hostResolverInfo); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 onHostResolverInfoChanged: function(hostResolverInfo) { | 70 onHostResolverInfoChanged: function(hostResolverInfo) { |
| 71 // Clear the existing values. | 71 // Clear the existing values. |
| 72 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerHTML = ''; | 72 $(DnsView.DEFAULT_FAMILY_SPAN_ID).innerHTML = ''; |
| 73 $(DnsView.CAPACITY_SPAN_ID).innerHTML = ''; | 73 $(DnsView.CAPACITY_SPAN_ID).innerHTML = ''; |
| 74 $(DnsView.TTL_SUCCESS_SPAN_ID).innerHTML = ''; | |
| 75 $(DnsView.TTL_FAILURE_SPAN_ID).innerHTML = ''; | |
| 76 $(DnsView.CACHE_TBODY_ID).innerHTML = ''; | 74 $(DnsView.CACHE_TBODY_ID).innerHTML = ''; |
| 77 $(DnsView.ACTIVE_SPAN_ID).innerHTML = '0'; | 75 $(DnsView.ACTIVE_SPAN_ID).innerHTML = '0'; |
| 78 $(DnsView.EXPIRED_SPAN_ID).innerHTML = '0'; | 76 $(DnsView.EXPIRED_SPAN_ID).innerHTML = '0'; |
| 79 | 77 |
| 80 // No info. | 78 // No info. |
| 81 if (!hostResolverInfo || !hostResolverInfo.cache) | 79 if (!hostResolverInfo || !hostResolverInfo.cache) |
| 82 return false; | 80 return false; |
| 83 | 81 |
| 84 var family = hostResolverInfo.default_address_family; | 82 var family = hostResolverInfo.default_address_family; |
| 85 addTextNode($(DnsView.DEFAULT_FAMILY_SPAN_ID), | 83 addTextNode($(DnsView.DEFAULT_FAMILY_SPAN_ID), |
| 86 getKeyWithValue(AddressFamily, family)); | 84 getKeyWithValue(AddressFamily, family)); |
| 87 | 85 |
| 88 var ipv6Disabled = (family == AddressFamily.ADDRESS_FAMILY_IPV4); | 86 var ipv6Disabled = (family == AddressFamily.ADDRESS_FAMILY_IPV4); |
| 89 setNodeDisplay($(DnsView.IPV6_DISABLED_SPAN_ID), ipv6Disabled); | 87 setNodeDisplay($(DnsView.IPV6_DISABLED_SPAN_ID), ipv6Disabled); |
| 90 | 88 |
| 91 // Fill in the basic cache information. | 89 // Fill in the basic cache information. |
| 92 var hostResolverCache = hostResolverInfo.cache; | 90 var hostResolverCache = hostResolverInfo.cache; |
| 93 $(DnsView.CAPACITY_SPAN_ID).innerText = hostResolverCache.capacity; | 91 $(DnsView.CAPACITY_SPAN_ID).innerText = hostResolverCache.capacity; |
| 94 $(DnsView.TTL_SUCCESS_SPAN_ID).innerText = | |
| 95 hostResolverCache.ttl_success_ms; | |
| 96 $(DnsView.TTL_FAILURE_SPAN_ID).innerText = | |
| 97 hostResolverCache.ttl_failure_ms; | |
| 98 | 92 |
| 99 var expiredEntries = 0; | 93 var expiredEntries = 0; |
| 100 // Date the cache was logged. This will be either now, when actively | 94 // Date the cache was logged. This will be either now, when actively |
| 101 // logging data, or the date the log dump was created. | 95 // logging data, or the date the log dump was created. |
| 102 var logDate; | 96 var logDate; |
| 103 if (MainView.isViewingLoadedLog()) { | 97 if (MainView.isViewingLoadedLog()) { |
| 104 if (typeof ClientInfo.numericDate == 'number') { | 98 if (typeof ClientInfo.numericDate == 'number') { |
| 105 logDate = new Date(ClientInfo.numericDate); | 99 logDate = new Date(ClientInfo.numericDate); |
| 106 } else { | 100 } else { |
| 107 // This is to prevent displaying entries as expired when loading | 101 // This is to prevent displaying entries as expired when loading |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 148 |
| 155 $(DnsView.ACTIVE_SPAN_ID).innerText = | 149 $(DnsView.ACTIVE_SPAN_ID).innerText = |
| 156 hostResolverCache.entries.length - expiredEntries; | 150 hostResolverCache.entries.length - expiredEntries; |
| 157 $(DnsView.EXPIRED_SPAN_ID).innerText = expiredEntries; | 151 $(DnsView.EXPIRED_SPAN_ID).innerText = expiredEntries; |
| 158 return true; | 152 return true; |
| 159 } | 153 } |
| 160 }; | 154 }; |
| 161 | 155 |
| 162 return DnsView; | 156 return DnsView; |
| 163 })(); | 157 })(); |
| OLD | NEW |