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

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

Issue 1908543002: DNS: Retain stale entries in HostCache and return when requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, make all members of Entry private Created 4 years, 7 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/dns/host_resolver_mojo.cc ('k') | net/log/net_log_util.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/dns/mock_host_resolver.h" 5 #include "net/dns/mock_host_resolver.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 addresses->SetDefaultCanonicalName(); 168 addresses->SetDefaultCanonicalName();
169 return OK; 169 return OK;
170 } 170 }
171 int rv = ERR_DNS_CACHE_MISS; 171 int rv = ERR_DNS_CACHE_MISS;
172 if (cache_.get() && info.allow_cached_response()) { 172 if (cache_.get() && info.allow_cached_response()) {
173 HostCache::Key key(info.hostname(), 173 HostCache::Key key(info.hostname(),
174 info.address_family(), 174 info.address_family(),
175 info.host_resolver_flags()); 175 info.host_resolver_flags());
176 const HostCache::Entry* entry = cache_->Lookup(key, base::TimeTicks::Now()); 176 const HostCache::Entry* entry = cache_->Lookup(key, base::TimeTicks::Now());
177 if (entry) { 177 if (entry) {
178 rv = entry->error; 178 rv = entry->error();
179 if (rv == OK) 179 if (rv == OK)
180 *addresses = AddressList::CopyWithPort(entry->addrlist, info.port()); 180 *addresses = AddressList::CopyWithPort(entry->addresses(), info.port());
181 } 181 }
182 } 182 }
183 return rv; 183 return rv;
184 } 184 }
185 185
186 int MockHostResolverBase::ResolveProc(size_t id, 186 int MockHostResolverBase::ResolveProc(size_t id,
187 const RequestInfo& info, 187 const RequestInfo& info,
188 AddressList* addresses) { 188 AddressList* addresses) {
189 AddressList addr; 189 AddressList addr;
190 int rv = rules_->Resolve(info.hostname(), 190 int rv = rules_->Resolve(info.hostname(),
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 CHECK_EQ(old_proc, current_proc_.get()); 452 CHECK_EQ(old_proc, current_proc_.get());
453 } 453 }
454 454
455 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { 455 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) {
456 current_proc_ = proc; 456 current_proc_ = proc;
457 previous_proc_ = HostResolverProc::SetDefault(current_proc_.get()); 457 previous_proc_ = HostResolverProc::SetDefault(current_proc_.get());
458 current_proc_->SetLastProc(previous_proc_.get()); 458 current_proc_->SetLastProc(previous_proc_.get());
459 } 459 }
460 460
461 } // namespace net 461 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/host_resolver_mojo.cc ('k') | net/log/net_log_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698