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

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

Issue 6976055: More POSIX support for Chromium, consisting mostly of broadening ifdefs. This (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « media/tools/shader_bench/shader_bench.cc ('k') | net/base/host_resolver_proc.cc » ('j') | 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) 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 #include "net/base/host_resolver_impl.h" 5 #include "net/base/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 return cache; 93 return cache;
94 } 94 }
95 95
96 // Gets a list of the likely error codes that getaddrinfo() can return 96 // Gets a list of the likely error codes that getaddrinfo() can return
97 // (non-exhaustive). These are the error codes that we will track via 97 // (non-exhaustive). These are the error codes that we will track via
98 // a histogram. 98 // a histogram.
99 std::vector<int> GetAllGetAddrinfoOSErrors() { 99 std::vector<int> GetAllGetAddrinfoOSErrors() {
100 int os_errors[] = { 100 int os_errors[] = {
101 #if defined(OS_POSIX) 101 #if defined(OS_POSIX)
102 #if !defined(OS_FREEBSD)
102 EAI_ADDRFAMILY, 103 EAI_ADDRFAMILY,
104 EAI_NODATA,
105 #endif
103 EAI_AGAIN, 106 EAI_AGAIN,
104 EAI_BADFLAGS, 107 EAI_BADFLAGS,
105 EAI_FAIL, 108 EAI_FAIL,
106 EAI_FAMILY, 109 EAI_FAMILY,
107 EAI_MEMORY, 110 EAI_MEMORY,
108 EAI_NODATA,
109 EAI_NONAME, 111 EAI_NONAME,
110 EAI_SERVICE, 112 EAI_SERVICE,
111 EAI_SOCKTYPE, 113 EAI_SOCKTYPE,
112 EAI_SYSTEM, 114 EAI_SYSTEM,
113 #elif defined(OS_WIN) 115 #elif defined(OS_WIN)
114 // See: http://msdn.microsoft.com/en-us/library/ms738520(VS.85).aspx 116 // See: http://msdn.microsoft.com/en-us/library/ms738520(VS.85).aspx
115 WSA_NOT_ENOUGH_MEMORY, 117 WSA_NOT_ENOUGH_MEMORY,
116 WSAEAFNOSUPPORT, 118 WSAEAFNOSUPPORT,
117 WSAEINVAL, 119 WSAEINVAL,
118 WSAESOCKTNOSUPPORT, 120 WSAESOCKTNOSUPPORT,
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 if (max_retry_attempts_ == HostResolver::kDefaultRetryAttempts) 1053 if (max_retry_attempts_ == HostResolver::kDefaultRetryAttempts)
1052 max_retry_attempts_ = kDefaultMaxRetryAttempts; 1054 max_retry_attempts_ = kDefaultMaxRetryAttempts;
1053 1055
1054 // It is cumbersome to expose all of the constraints in the constructor, 1056 // It is cumbersome to expose all of the constraints in the constructor,
1055 // so we choose some defaults, which users can override later. 1057 // so we choose some defaults, which users can override later.
1056 job_pools_[POOL_NORMAL] = new JobPool(max_jobs, 100u * max_jobs); 1058 job_pools_[POOL_NORMAL] = new JobPool(max_jobs, 100u * max_jobs);
1057 1059
1058 #if defined(OS_WIN) 1060 #if defined(OS_WIN)
1059 EnsureWinsockInit(); 1061 EnsureWinsockInit();
1060 #endif 1062 #endif
1061 #if defined(OS_LINUX) 1063 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1062 if (HaveOnlyLoopbackAddresses()) 1064 if (HaveOnlyLoopbackAddresses())
1063 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; 1065 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
1064 #endif 1066 #endif
1065 NetworkChangeNotifier::AddIPAddressObserver(this); 1067 NetworkChangeNotifier::AddIPAddressObserver(this);
1066 } 1068 }
1067 1069
1068 HostResolverImpl::~HostResolverImpl() { 1070 HostResolverImpl::~HostResolverImpl() {
1069 // Cancel the outstanding jobs. Those jobs may contain several attached 1071 // Cancel the outstanding jobs. Those jobs may contain several attached
1070 // requests, which will also be cancelled. 1072 // requests, which will also be cancelled.
1071 DiscardIPv6ProbeJob(); 1073 DiscardIPv6ProbeJob();
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 if (cache_.get()) 1593 if (cache_.get())
1592 cache_->clear(); 1594 cache_->clear();
1593 if (ipv6_probe_monitoring_) { 1595 if (ipv6_probe_monitoring_) {
1594 DCHECK(!shutdown_); 1596 DCHECK(!shutdown_);
1595 if (shutdown_) 1597 if (shutdown_)
1596 return; 1598 return;
1597 DiscardIPv6ProbeJob(); 1599 DiscardIPv6ProbeJob();
1598 ipv6_probe_job_ = new IPv6ProbeJob(this); 1600 ipv6_probe_job_ = new IPv6ProbeJob(this);
1599 ipv6_probe_job_->Start(); 1601 ipv6_probe_job_->Start();
1600 } 1602 }
1601 #if defined(OS_LINUX) 1603 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1602 if (HaveOnlyLoopbackAddresses()) { 1604 if (HaveOnlyLoopbackAddresses()) {
1603 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; 1605 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
1604 } else { 1606 } else {
1605 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; 1607 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY;
1606 } 1608 }
1607 #endif 1609 #endif
1608 AbortAllInProgressJobs(); 1610 AbortAllInProgressJobs();
1609 // |this| may be deleted inside AbortAllInProgressJobs(). 1611 // |this| may be deleted inside AbortAllInProgressJobs().
1610 } 1612 }
1611 1613
1612 } // namespace net 1614 } // namespace net
OLDNEW
« no previous file with comments | « media/tools/shader_bench/shader_bench.cc ('k') | net/base/host_resolver_proc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698