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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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
« no previous file with comments | « net/base/listen_socket.cc ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mock_host_resolver.h" 5 #include "net/base/mock_host_resolver.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 void MockHostResolverBase::RemoveObserver(Observer* observer) { 75 void MockHostResolverBase::RemoveObserver(Observer* observer) {
76 impl_->RemoveObserver(observer); 76 impl_->RemoveObserver(observer);
77 } 77 }
78 78
79 void MockHostResolverBase::Reset(HostResolverProc* interceptor) { 79 void MockHostResolverBase::Reset(HostResolverProc* interceptor) {
80 synchronous_mode_ = false; 80 synchronous_mode_ = false;
81 81
82 // At the root of the chain, map everything to localhost. 82 // At the root of the chain, map everything to localhost.
83 scoped_refptr<RuleBasedHostResolverProc> catchall = 83 scoped_refptr<RuleBasedHostResolverProc> catchall(
84 new RuleBasedHostResolverProc(NULL); 84 new RuleBasedHostResolverProc(NULL));
85 catchall->AddRule("*", "127.0.0.1"); 85 catchall->AddRule("*", "127.0.0.1");
86 86
87 // Next add a rules-based layer the use controls. 87 // Next add a rules-based layer the use controls.
88 rules_ = new RuleBasedHostResolverProc(catchall); 88 rules_ = new RuleBasedHostResolverProc(catchall);
89 89
90 HostResolverProc* proc = rules_; 90 HostResolverProc* proc = rules_;
91 91
92 // Lastly add the provided interceptor to the front of the chain. 92 // Lastly add the provided interceptor to the front of the chain.
93 if (interceptor) { 93 if (interceptor) {
94 interceptor->SetPreviousProc(proc); 94 interceptor->SetPreviousProc(proc);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CHECK_EQ(old_proc, current_proc_); 294 CHECK_EQ(old_proc, current_proc_);
295 } 295 }
296 296
297 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { 297 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) {
298 current_proc_ = proc; 298 current_proc_ = proc;
299 previous_proc_ = HostResolverProc::SetDefault(current_proc_); 299 previous_proc_ = HostResolverProc::SetDefault(current_proc_);
300 current_proc_->SetLastProc(previous_proc_); 300 current_proc_->SetLastProc(previous_proc_);
301 } 301 }
302 302
303 } // namespace net 303 } // namespace net
OLDNEW
« no previous file with comments | « net/base/listen_socket.cc ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698