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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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) 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 #ifndef NET_DNS_MOCK_HOST_RESOLVER_H_ 5 #ifndef NET_DNS_MOCK_HOST_RESOLVER_H_
6 #define NET_DNS_MOCK_HOST_RESOLVER_H_ 6 #define NET_DNS_MOCK_HOST_RESOLVER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void set_ondemand_mode(bool is_ondemand) { 79 void set_ondemand_mode(bool is_ondemand) {
80 ondemand_mode_ = is_ondemand; 80 ondemand_mode_ = is_ondemand;
81 } 81 }
82 82
83 // HostResolver methods: 83 // HostResolver methods:
84 int Resolve(const RequestInfo& info, 84 int Resolve(const RequestInfo& info,
85 RequestPriority priority, 85 RequestPriority priority,
86 AddressList* addresses, 86 AddressList* addresses,
87 const CompletionCallback& callback, 87 const CompletionCallback& callback,
88 std::unique_ptr<Request>* request, 88 std::unique_ptr<Request>* request,
89 const BoundNetLog& net_log) override; 89 const NetLogWithSource& net_log) override;
90 int ResolveFromCache(const RequestInfo& info, 90 int ResolveFromCache(const RequestInfo& info,
91 AddressList* addresses, 91 AddressList* addresses,
92 const BoundNetLog& net_log) override; 92 const NetLogWithSource& net_log) override;
93 HostCache* GetHostCache() override; 93 HostCache* GetHostCache() override;
94 94
95 // Detach cancelled request. 95 // Detach cancelled request.
96 void DetachRequest(size_t id); 96 void DetachRequest(size_t id);
97 97
98 // Resolves all pending requests. It is only valid to invoke this if 98 // Resolves all pending requests. It is only valid to invoke this if
99 // set_ondemand_mode was set before. The requests are resolved asynchronously, 99 // set_ondemand_mode was set before. The requests are resolved asynchronously,
100 // after this call returns. 100 // after this call returns.
101 void ResolveAllPending(); 101 void ResolveAllPending();
102 102
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 RuleBasedHostResolverProc* CreateCatchAllHostResolverProc(); 237 RuleBasedHostResolverProc* CreateCatchAllHostResolverProc();
238 238
239 // HangingHostResolver never completes its |Resolve| request. 239 // HangingHostResolver never completes its |Resolve| request.
240 class HangingHostResolver : public HostResolver { 240 class HangingHostResolver : public HostResolver {
241 public: 241 public:
242 int Resolve(const RequestInfo& info, 242 int Resolve(const RequestInfo& info,
243 RequestPriority priority, 243 RequestPriority priority,
244 AddressList* addresses, 244 AddressList* addresses,
245 const CompletionCallback& callback, 245 const CompletionCallback& callback,
246 std::unique_ptr<Request>* out_req, 246 std::unique_ptr<Request>* out_req,
247 const BoundNetLog& net_log) override; 247 const NetLogWithSource& net_log) override;
248 int ResolveFromCache(const RequestInfo& info, 248 int ResolveFromCache(const RequestInfo& info,
249 AddressList* addresses, 249 AddressList* addresses,
250 const BoundNetLog& net_log) override; 250 const NetLogWithSource& net_log) override;
251 }; 251 };
252 252
253 // This class sets the default HostResolverProc for a particular scope. The 253 // This class sets the default HostResolverProc for a particular scope. The
254 // chain of resolver procs starting at |proc| is placed in front of any existing 254 // chain of resolver procs starting at |proc| is placed in front of any existing
255 // default resolver proc(s). This means that if multiple 255 // default resolver proc(s). This means that if multiple
256 // ScopedDefaultHostResolverProcs are declared, then resolving will start with 256 // ScopedDefaultHostResolverProcs are declared, then resolving will start with
257 // the procs given to the last-allocated one, then fall back to the procs given 257 // the procs given to the last-allocated one, then fall back to the procs given
258 // to the previously-allocated one, and so forth. 258 // to the previously-allocated one, and so forth.
259 // 259 //
260 // NOTE: Only use this as a catch-all safety net. Individual tests should use 260 // NOTE: Only use this as a catch-all safety net. Individual tests should use
261 // MockHostResolver. 261 // MockHostResolver.
262 class ScopedDefaultHostResolverProc { 262 class ScopedDefaultHostResolverProc {
263 public: 263 public:
264 ScopedDefaultHostResolverProc(); 264 ScopedDefaultHostResolverProc();
265 explicit ScopedDefaultHostResolverProc(HostResolverProc* proc); 265 explicit ScopedDefaultHostResolverProc(HostResolverProc* proc);
266 266
267 ~ScopedDefaultHostResolverProc(); 267 ~ScopedDefaultHostResolverProc();
268 268
269 void Init(HostResolverProc* proc); 269 void Init(HostResolverProc* proc);
270 270
271 private: 271 private:
272 scoped_refptr<HostResolverProc> current_proc_; 272 scoped_refptr<HostResolverProc> current_proc_;
273 scoped_refptr<HostResolverProc> previous_proc_; 273 scoped_refptr<HostResolverProc> previous_proc_;
274 }; 274 };
275 275
276 } // namespace net 276 } // namespace net
277 277
278 #endif // NET_DNS_MOCK_HOST_RESOLVER_H_ 278 #endif // NET_DNS_MOCK_HOST_RESOLVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698