OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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/dns/host_resolver_mojo.h" | 5 #include "net/dns/host_resolver_mojo.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 HostCache::Key key = CacheKeyForRequest(info); | 82 HostCache::Key key = CacheKeyForRequest(info); |
83 int cached_result = ResolveFromCacheInternal(info, key, addresses); | 83 int cached_result = ResolveFromCacheInternal(info, key, addresses); |
84 if (cached_result != ERR_DNS_CACHE_MISS) { | 84 if (cached_result != ERR_DNS_CACHE_MISS) { |
85 DVLOG(1) << "Resolved " << info.host_port_pair().ToString() | 85 DVLOG(1) << "Resolved " << info.host_port_pair().ToString() |
86 << " from cache"; | 86 << " from cache"; |
87 return cached_result; | 87 return cached_result; |
88 } | 88 } |
89 | 89 |
90 interfaces::HostResolverRequestClientPtr handle; | 90 interfaces::HostResolverRequestClientPtr handle; |
91 std::unique_ptr<Job> job(new Job(key, addresses, callback, | 91 std::unique_ptr<Job> job(new Job(key, addresses, callback, |
92 mojo::GetProxy(&handle), | 92 mojo::MakeRequest(&handle), |
93 host_cache_weak_factory_.GetWeakPtr())); | 93 host_cache_weak_factory_.GetWeakPtr())); |
94 request->reset(new RequestImpl(std::move(job))); | 94 request->reset(new RequestImpl(std::move(job))); |
95 | 95 |
96 impl_->ResolveDns(base::MakeUnique<HostResolver::RequestInfo>(info), | 96 impl_->ResolveDns(base::MakeUnique<HostResolver::RequestInfo>(info), |
97 std::move(handle)); | 97 std::move(handle)); |
98 return ERR_IO_PENDING; | 98 return ERR_IO_PENDING; |
99 } | 99 } |
100 | 100 |
101 int HostResolverMojo::ResolveFromCache(const RequestInfo& info, | 101 int HostResolverMojo::ResolveFromCache(const RequestInfo& info, |
102 AddressList* addresses, | 102 AddressList* addresses, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 if (binding_.is_bound()) | 153 if (binding_.is_bound()) |
154 binding_.Close(); | 154 binding_.Close(); |
155 base::ResetAndReturn(&callback_).Run(error); | 155 base::ResetAndReturn(&callback_).Run(error); |
156 } | 156 } |
157 | 157 |
158 void HostResolverMojo::Job::OnConnectionError() { | 158 void HostResolverMojo::Job::OnConnectionError() { |
159 ReportResult(ERR_FAILED, AddressList()); | 159 ReportResult(ERR_FAILED, AddressList()); |
160 } | 160 } |
161 | 161 |
162 } // namespace net | 162 } // namespace net |
OLD | NEW |