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

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

Issue 1604045: Fix crash on IP address change. (Closed)
Patch Set: Merge conflict Created 10 years, 8 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
« no previous file with comments | « net/base/mock_host_resolver.h ('k') | net/http/http_cache.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 "googleurl/src/url_canon_ip.h" 10 #include "googleurl/src/url_canon_ip.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void MockHostResolverBase::AddObserver(Observer* observer) { 61 void MockHostResolverBase::AddObserver(Observer* observer) {
62 impl_->AddObserver(observer); 62 impl_->AddObserver(observer);
63 } 63 }
64 64
65 void MockHostResolverBase::RemoveObserver(Observer* observer) { 65 void MockHostResolverBase::RemoveObserver(Observer* observer) {
66 impl_->RemoveObserver(observer); 66 impl_->RemoveObserver(observer);
67 } 67 }
68 68
69 void MockHostResolverBase::Flush() {
70 impl_->Flush();
71 }
72
73 void MockHostResolverBase::Reset(HostResolverProc* interceptor) { 69 void MockHostResolverBase::Reset(HostResolverProc* interceptor) {
74 synchronous_mode_ = false; 70 synchronous_mode_ = false;
75 71
76 // At the root of the chain, map everything to localhost. 72 // At the root of the chain, map everything to localhost.
77 scoped_refptr<RuleBasedHostResolverProc> catchall = 73 scoped_refptr<RuleBasedHostResolverProc> catchall =
78 new RuleBasedHostResolverProc(NULL); 74 new RuleBasedHostResolverProc(NULL);
79 catchall->AddRule("*", "127.0.0.1"); 75 catchall->AddRule("*", "127.0.0.1");
80 76
81 // Next add a rules-based layer the use controls. 77 // Next add a rules-based layer the use controls.
82 rules_ = new RuleBasedHostResolverProc(catchall); 78 rules_ = new RuleBasedHostResolverProc(catchall);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 CHECK_EQ(old_proc, current_proc_); 233 CHECK_EQ(old_proc, current_proc_);
238 } 234 }
239 235
240 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { 236 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) {
241 current_proc_ = proc; 237 current_proc_ = proc;
242 previous_proc_ = HostResolverProc::SetDefault(current_proc_); 238 previous_proc_ = HostResolverProc::SetDefault(current_proc_);
243 current_proc_->SetLastProc(previous_proc_); 239 current_proc_->SetLastProc(previous_proc_);
244 } 240 }
245 241
246 } // namespace net 242 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mock_host_resolver.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698