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

Side by Side Diff: net/dns/host_resolver_impl.cc

Issue 22068002: Avoid wasted work in OnProcTaskComplete(). (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/dns/host_resolver_impl.h" 5 #include "net/dns/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 const AddressList& addr_list) { 1393 const AddressList& addr_list) {
1394 DCHECK(is_proc_running()); 1394 DCHECK(is_proc_running());
1395 1395
1396 if (!resolver_->resolved_known_ipv6_hostname_ && 1396 if (!resolver_->resolved_known_ipv6_hostname_ &&
1397 net_error == OK && 1397 net_error == OK &&
1398 key_.address_family == ADDRESS_FAMILY_UNSPECIFIED) { 1398 key_.address_family == ADDRESS_FAMILY_UNSPECIFIED) {
1399 if (key_.hostname == "www.google.com") { 1399 if (key_.hostname == "www.google.com") {
1400 resolver_->resolved_known_ipv6_hostname_ = true; 1400 resolver_->resolved_known_ipv6_hostname_ = true;
1401 bool got_ipv6_address = false; 1401 bool got_ipv6_address = false;
1402 for (size_t i = 0; i < addr_list.size(); ++i) { 1402 for (size_t i = 0; i < addr_list.size(); ++i) {
1403 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) 1403 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) {
1404 got_ipv6_address = true; 1404 got_ipv6_address = true;
1405 break;
1406 }
1405 } 1407 }
1406 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address); 1408 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address);
1407 } 1409 }
1408 } 1410 }
1409 1411
1410 if (dns_task_error_ != OK) { 1412 if (dns_task_error_ != OK) {
1411 base::TimeDelta duration = base::TimeTicks::Now() - start_time; 1413 base::TimeDelta duration = base::TimeTicks::Now() - start_time;
1412 if (net_error == OK) { 1414 if (net_error == OK) {
1413 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); 1415 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration);
1414 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && 1416 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) &&
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 } 2197 }
2196 DnsConfig dns_config; 2198 DnsConfig dns_config;
2197 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2199 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2198 dns_client_->SetConfig(dns_config); 2200 dns_client_->SetConfig(dns_config);
2199 num_dns_failures_ = 0; 2201 num_dns_failures_ = 0;
2200 if (dns_config.IsValid()) 2202 if (dns_config.IsValid())
2201 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2203 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2202 } 2204 }
2203 2205
2204 } // namespace net 2206 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698