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

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

Issue 7492059: HostResolver: don't interpret NULL callback argument as a request to do synchronous resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged common code from Resolve and ResolveFromCache to a single function. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/mapped_host_resolver.h" 5 #include "net/base/mapped_host_resolver.h"
6 6
7 #include "base/string_tokenizer.h" 7 #include "base/string_tokenizer.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/host_port_pair.h" 9 #include "net/base/host_port_pair.h"
10 #include "net/base/net_errors.h"
10 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
11 12
12 namespace net { 13 namespace net {
13 14
14 MappedHostResolver::MappedHostResolver(HostResolver* impl) 15 MappedHostResolver::MappedHostResolver(HostResolver* impl)
15 : impl_(impl) { 16 : impl_(impl) {
16 } 17 }
17 18
18 MappedHostResolver::~MappedHostResolver() { 19 MappedHostResolver::~MappedHostResolver() {
19 } 20 }
20 21
21 int MappedHostResolver::Resolve(const RequestInfo& info, 22 int MappedHostResolver::Resolve(const RequestInfo& info,
22 AddressList* addresses, 23 AddressList* addresses,
23 CompletionCallback* callback, 24 CompletionCallback* callback,
24 RequestHandle* out_req, 25 RequestHandle* out_req,
25 const BoundNetLog& net_log) { 26 const BoundNetLog& net_log) {
27 DCHECK(addresses);
28 DCHECK(callback);
26 // Modify the request before forwarding it to |impl_|. 29 // Modify the request before forwarding it to |impl_|.
27 RequestInfo modified_info = info; 30 RequestInfo modified_info = info;
28 HostPortPair host_port(info.host_port_pair()); 31 HostPortPair host_port(info.host_port_pair());
29 if (rules_.RewriteHost(&host_port)) 32 if (rules_.RewriteHost(&host_port))
30 modified_info.set_host_port_pair(host_port); 33 modified_info.set_host_port_pair(host_port);
31 return impl_->Resolve(modified_info, addresses, callback, out_req, net_log); 34 return impl_->Resolve(modified_info, addresses, callback, out_req, net_log);
32 } 35 }
33 36
37 int MappedHostResolver::ResolveFromCache(const RequestInfo& info,
38 AddressList* addresses,
39 const BoundNetLog& net_log) {
40 NOTIMPLEMENTED();
41 return ERR_UNEXPECTED;
42 }
43
34 void MappedHostResolver::CancelRequest(RequestHandle req) { 44 void MappedHostResolver::CancelRequest(RequestHandle req) {
35 impl_->CancelRequest(req); 45 impl_->CancelRequest(req);
36 } 46 }
37 47
38 void MappedHostResolver::AddObserver(Observer* observer) { 48 void MappedHostResolver::AddObserver(Observer* observer) {
39 impl_->AddObserver(observer); 49 impl_->AddObserver(observer);
40 } 50 }
41 51
42 void MappedHostResolver::RemoveObserver(Observer* observer) { 52 void MappedHostResolver::RemoveObserver(Observer* observer) {
43 impl_->RemoveObserver(observer); 53 impl_->RemoveObserver(observer);
44 } 54 }
45 55
46 HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() { 56 HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() {
47 return impl_->GetAsHostResolverImpl(); 57 return impl_->GetAsHostResolverImpl();
48 } 58 }
49 59
50 } // namespace net 60 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698