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

Side by Side Diff: net/base/mock_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) 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 #include "net/base/mock_host_resolver.h" 5 #include "net/base/mock_host_resolver.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 int rv = impl_->Resolve(info, addresses, &sync_callback, out_req, net_log); 105 int rv = impl_->Resolve(info, addresses, &sync_callback, out_req, net_log);
106 if (rv == ERR_IO_PENDING) { 106 if (rv == ERR_IO_PENDING) {
107 MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current()); 107 MessageLoop::ScopedNestableTaskAllower nestable(MessageLoop::current());
108 return sync_callback.WaitForResult(); 108 return sync_callback.WaitForResult();
109 } 109 }
110 return rv; 110 return rv;
111 } 111 }
112 return impl_->Resolve(info, addresses, callback, out_req, net_log); 112 return impl_->Resolve(info, addresses, callback, out_req, net_log);
113 } 113 }
114 114
115 int MockHostResolverBase::ResolveFromCache(const RequestInfo& info,
116 AddressList* addresses,
117 const BoundNetLog& net_log) {
118 return impl_->ResolveFromCache(info, addresses, net_log);
119 }
120
115 void MockHostResolverBase::CancelRequest(RequestHandle req) { 121 void MockHostResolverBase::CancelRequest(RequestHandle req) {
116 impl_->CancelRequest(req); 122 impl_->CancelRequest(req);
117 } 123 }
118 124
119 void MockHostResolverBase::AddObserver(Observer* observer) { 125 void MockHostResolverBase::AddObserver(Observer* observer) {
120 impl_->AddObserver(observer); 126 impl_->AddObserver(observer);
121 } 127 }
122 128
123 void MockHostResolverBase::RemoveObserver(Observer* observer) { 129 void MockHostResolverBase::RemoveObserver(Observer* observer) {
124 impl_->RemoveObserver(observer); 130 impl_->RemoveObserver(observer);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 CHECK_EQ(old_proc, current_proc_); 325 CHECK_EQ(old_proc, current_proc_);
320 } 326 }
321 327
322 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { 328 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) {
323 current_proc_ = proc; 329 current_proc_ = proc;
324 previous_proc_ = HostResolverProc::SetDefault(current_proc_); 330 previous_proc_ = HostResolverProc::SetDefault(current_proc_);
325 current_proc_->SetLastProc(previous_proc_); 331 current_proc_->SetLastProc(previous_proc_);
326 } 332 }
327 333
328 } // namespace net 334 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698