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

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

Issue 11065052: [net] Add AsyncDNS.TTL histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add NET_EXPORT to HostCache::Entry Created 8 years, 2 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
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/proxy/proxy_resolver_js_bindings.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/base/mock_host_resolver.h" 5 #include "net/base/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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 &addr, 164 &addr,
165 NULL); 165 NULL);
166 if (cache_.get()) { 166 if (cache_.get()) {
167 HostCache::Key key(info.hostname(), 167 HostCache::Key key(info.hostname(),
168 info.address_family(), 168 info.address_family(),
169 info.host_resolver_flags()); 169 info.host_resolver_flags());
170 // Storing a failure with TTL 0 so that it overwrites previous value. 170 // Storing a failure with TTL 0 so that it overwrites previous value.
171 base::TimeDelta ttl; 171 base::TimeDelta ttl;
172 if (rv == OK) 172 if (rv == OK)
173 ttl = base::TimeDelta::FromSeconds(kCacheEntryTTLSeconds); 173 ttl = base::TimeDelta::FromSeconds(kCacheEntryTTLSeconds);
174 cache_->Set(key, rv, addr, base::TimeTicks::Now(), ttl); 174 cache_->Set(key, HostCache::Entry(rv, addr), base::TimeTicks::Now(), ttl);
175 } 175 }
176 if (rv == OK) { 176 if (rv == OK) {
177 *addresses = addr; 177 *addresses = addr;
178 SetPortOnAddressList(info.port(), addresses); 178 SetPortOnAddressList(info.port(), addresses);
179 } 179 }
180 return rv; 180 return rv;
181 } 181 }
182 182
183 void MockHostResolverBase::ResolveNow(size_t id) { 183 void MockHostResolverBase::ResolveNow(size_t id) {
184 RequestMap::iterator it = requests_.find(id); 184 RequestMap::iterator it = requests_.find(id);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 CHECK_EQ(old_proc, current_proc_); 390 CHECK_EQ(old_proc, current_proc_);
391 } 391 }
392 392
393 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { 393 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) {
394 current_proc_ = proc; 394 current_proc_ = proc;
395 previous_proc_ = HostResolverProc::SetDefault(current_proc_); 395 previous_proc_ = HostResolverProc::SetDefault(current_proc_);
396 current_proc_->SetLastProc(previous_proc_); 396 current_proc_->SetLastProc(previous_proc_);
397 } 397 }
398 398
399 } // namespace net 399 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_resolver_impl.cc ('k') | net/proxy/proxy_resolver_js_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698