| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/tools/quic/synchronous_host_resolver.h" | 5 #include "net/tools/quic/synchronous_host_resolver.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 options.max_retry_attempts = 3u; | 61 options.max_retry_attempts = 3u; |
| 62 std::unique_ptr<net::HostResolverImpl> resolver( | 62 std::unique_ptr<net::HostResolverImpl> resolver( |
| 63 new net::HostResolverImpl(options, &net_log)); | 63 new net::HostResolverImpl(options, &net_log)); |
| 64 | 64 |
| 65 std::unique_ptr<net::HostResolver::Request> request; | 65 std::unique_ptr<net::HostResolver::Request> request; |
| 66 HostPortPair host_port_pair(host_, 80); | 66 HostPortPair host_port_pair(host_, 80); |
| 67 rv_ = resolver->Resolve(HostResolver::RequestInfo(host_port_pair), | 67 rv_ = resolver->Resolve(HostResolver::RequestInfo(host_port_pair), |
| 68 DEFAULT_PRIORITY, addresses_, | 68 DEFAULT_PRIORITY, addresses_, |
| 69 base::Bind(&ResolverThread::OnResolutionComplete, | 69 base::Bind(&ResolverThread::OnResolutionComplete, |
| 70 weak_factory_.GetWeakPtr()), | 70 weak_factory_.GetWeakPtr()), |
| 71 &request, BoundNetLog()); | 71 &request, NetLogWithSource()); |
| 72 | 72 |
| 73 if (rv_ != ERR_IO_PENDING) | 73 if (rv_ != ERR_IO_PENDING) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 // Run the mesage loop until OnResolutionComplete quits it. | 76 // Run the mesage loop until OnResolutionComplete quits it. |
| 77 base::RunLoop().Run(); | 77 base::RunLoop().Run(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 int ResolverThread::Resolve(const std::string& host, AddressList* addresses) { | 80 int ResolverThread::Resolve(const std::string& host, AddressList* addresses) { |
| 81 host_ = host; | 81 host_ = host; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 // static | 96 // static |
| 97 int SynchronousHostResolver::Resolve(const std::string& host, | 97 int SynchronousHostResolver::Resolve(const std::string& host, |
| 98 AddressList* addresses) { | 98 AddressList* addresses) { |
| 99 ResolverThread resolver; | 99 ResolverThread resolver; |
| 100 return resolver.Resolve(host, addresses); | 100 return resolver.Resolve(host, addresses); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace net | 103 } // namespace net |
| OLD | NEW |