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

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

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr Created 4 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
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 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_ 5 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_
6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // HostResolverProc from ProcTaskParams will be queried. If the DnsClient is 129 // HostResolverProc from ProcTaskParams will be queried. If the DnsClient is
130 // not pre-configured with a valid DnsConfig, a new config is fetched from 130 // not pre-configured with a valid DnsConfig, a new config is fetched from
131 // NetworkChangeNotifier. 131 // NetworkChangeNotifier.
132 void SetDnsClient(std::unique_ptr<DnsClient> dns_client); 132 void SetDnsClient(std::unique_ptr<DnsClient> dns_client);
133 133
134 // HostResolver methods: 134 // HostResolver methods:
135 int Resolve(const RequestInfo& info, 135 int Resolve(const RequestInfo& info,
136 RequestPriority priority, 136 RequestPriority priority,
137 AddressList* addresses, 137 AddressList* addresses,
138 const CompletionCallback& callback, 138 const CompletionCallback& callback,
139 RequestHandle* out_req, 139 std::unique_ptr<Request>* out_req,
140 const BoundNetLog& source_net_log) override; 140 const BoundNetLog& source_net_log) override;
141 void ChangeRequestPriority(RequestHandle req,
142 RequestPriority priority) override;
143 void CancelRequest(RequestHandle req) override;
144 int ResolveFromCache(const RequestInfo& info, 141 int ResolveFromCache(const RequestInfo& info,
145 AddressList* addresses, 142 AddressList* addresses,
146 const BoundNetLog& source_net_log) override; 143 const BoundNetLog& source_net_log) override;
147 void SetDnsClientEnabled(bool enabled) override; 144 void SetDnsClientEnabled(bool enabled) override;
148 HostCache* GetHostCache() override; 145 HostCache* GetHostCache() override;
149 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override; 146 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override;
150 147
151 // Like |ResolveFromCache()|, but can return a stale result if the 148 // Like |ResolveFromCache()|, but can return a stale result if the
152 // implementation supports it. Fills in |*stale_info| if a response is 149 // implementation supports it. Fills in |*stale_info| if a response is
153 // returned to indicate how stale (or not) it is. 150 // returned to indicate how stale (or not) it is.
(...skipping 15 matching lines...) Expand all
169 166
170 // Callback from HaveOnlyLoopbackAddresses probe. 167 // Callback from HaveOnlyLoopbackAddresses probe.
171 void SetHaveOnlyLoopbackAddresses(bool result); 168 void SetHaveOnlyLoopbackAddresses(bool result);
172 169
173 private: 170 private:
174 friend class HostResolverImplTest; 171 friend class HostResolverImplTest;
175 class Job; 172 class Job;
176 class ProcTask; 173 class ProcTask;
177 class LoopbackProbeJob; 174 class LoopbackProbeJob;
178 class DnsTask; 175 class DnsTask;
179 class Request; 176 class RequestImpl;
180 typedef HostCache::Key Key; 177 typedef HostCache::Key Key;
181 typedef std::map<Key, Job*> JobMap; 178 typedef std::map<Key, Job*> JobMap;
182 179
183 // Number of consecutive failures of DnsTask (with successful fallback to 180 // Number of consecutive failures of DnsTask (with successful fallback to
184 // ProcTask) before the DnsClient is disabled until the next DNS change. 181 // ProcTask) before the DnsClient is disabled until the next DNS change.
185 static const unsigned kMaximumDnsFailures; 182 static const unsigned kMaximumDnsFailures;
186 183
187 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP 184 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP
188 // literal, cache and HOSTS lookup (if enabled), returns OK if successful, 185 // literal, cache and HOSTS lookup (if enabled), returns OK if successful,
189 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is 186 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // This function is only exposed so it can be unit-tested. 365 // This function is only exposed so it can be unit-tested.
369 // TODO(tfarina): It would be better to change the tests so this function 366 // TODO(tfarina): It would be better to change the tests so this function
370 // gets exercised indirectly through HostResolverImpl. 367 // gets exercised indirectly through HostResolverImpl.
371 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, 368 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host,
372 uint16_t port, 369 uint16_t port,
373 AddressList* address_list); 370 AddressList* address_list);
374 371
375 } // namespace net 372 } // namespace net
376 373
377 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ 374 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698