| OLD | NEW |
| 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 #include "net/dns/dns_config_service.h" | 5 #include "net/dns/dns_config_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (a == NAME_SERVERS_TYPE_NONE) | 87 if (a == NAME_SERVERS_TYPE_NONE) |
| 88 return b; | 88 return b; |
| 89 if (b == NAME_SERVERS_TYPE_NONE) | 89 if (b == NAME_SERVERS_TYPE_NONE) |
| 90 return a; | 90 return a; |
| 91 if (a == b) | 91 if (a == b) |
| 92 return a; | 92 return a; |
| 93 return NAME_SERVERS_TYPE_MIXED; | 93 return NAME_SERVERS_TYPE_MIXED; |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Default values are taken from glibc resolv.h except timeout which is set to | 96 // Default values are taken from glibc resolv.h except timeout which is set to |
| 97 // |kDnsTimeoutSeconds|. | 97 // |kDnsDefaultTimeoutMs|. |
| 98 DnsConfig::DnsConfig() | 98 DnsConfig::DnsConfig() |
| 99 : unhandled_options(false), | 99 : unhandled_options(false), |
| 100 append_to_multi_label_name(true), | 100 append_to_multi_label_name(true), |
| 101 randomize_ports(false), | 101 randomize_ports(false), |
| 102 ndots(1), | 102 ndots(1), |
| 103 timeout(base::TimeDelta::FromSeconds(kDnsTimeoutSeconds)), | 103 timeout(base::TimeDelta::FromMilliseconds(kDnsDefaultTimeoutMs)), |
| 104 attempts(2), | 104 attempts(2), |
| 105 rotate(false), | 105 rotate(false), |
| 106 edns0(false), | 106 edns0(false), |
| 107 use_local_ipv6(false) {} | 107 use_local_ipv6(false) {} |
| 108 | 108 |
| 109 DnsConfig::DnsConfig(const DnsConfig& other) = default; | 109 DnsConfig::DnsConfig(const DnsConfig& other) = default; |
| 110 | 110 |
| 111 DnsConfig::~DnsConfig() {} | 111 DnsConfig::~DnsConfig() {} |
| 112 | 112 |
| 113 bool DnsConfig::Equals(const DnsConfig& d) const { | 113 bool DnsConfig::Equals(const DnsConfig& d) const { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 if (watch_failed_) { | 312 if (watch_failed_) { |
| 313 // If a watch failed, the config may not be accurate, so report empty. | 313 // If a watch failed, the config may not be accurate, so report empty. |
| 314 callback_.Run(DnsConfig()); | 314 callback_.Run(DnsConfig()); |
| 315 } else { | 315 } else { |
| 316 callback_.Run(dns_config_); | 316 callback_.Run(dns_config_); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace net | 320 } // namespace net |
| 321 | 321 |
| OLD | NEW |