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

Side by Side Diff: chrome/browser/net/dns_global.cc

Issue 149511: Refactorings surrounding HostResolver:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merge in socks5_client_socket_unittest.cc Created 11 years, 5 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 | « chrome/browser/browser_unittest.cc ('k') | chrome/browser/net/dns_master_unittest.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/net/dns_global.h" 5 #include "chrome/browser/net/dns_global.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 if (!dns_master) 469 if (!dns_master)
470 return; 470 return;
471 dns_master->DiscardAllResults(); 471 dns_master->DiscardAllResults();
472 } 472 }
473 473
474 //------------------------------------------------------------------------------ 474 //------------------------------------------------------------------------------
475 475
476 net::HostResolver* GetGlobalHostResolver() { 476 net::HostResolver* GetGlobalHostResolver() {
477 // Called from UI thread. 477 // Called from UI thread.
478 if (!global_host_resolver) { 478 if (!global_host_resolver) {
479 static const size_t kMaxHostCacheEntries = 100; 479 global_host_resolver = net::CreateSystemHostResolver();
480 static const size_t kHostCacheExpirationSeconds = 60; // 1 minute.
481
482 global_host_resolver = new net::HostResolver(
483 kMaxHostCacheEntries, kHostCacheExpirationSeconds * 1000);
484 } 480 }
485 return global_host_resolver; 481 return global_host_resolver;
486 } 482 }
487 483
488 //------------------------------------------------------------------------------ 484 //------------------------------------------------------------------------------
489 // Functions to handle saving of hostnames from one session to the next, to 485 // Functions to handle saving of hostnames from one session to the next, to
490 // expedite startup times. 486 // expedite startup times.
491 487
492 void SaveHostNamesForNextStartup(PrefService* local_state) { 488 void SaveHostNamesForNextStartup(PrefService* local_state) {
493 if (!dns_prefetch_enabled) 489 if (!dns_prefetch_enabled)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 611 }
616 } 612 }
617 613
618 DnsPrefetcherInit::~DnsPrefetcherInit() { 614 DnsPrefetcherInit::~DnsPrefetcherInit() {
619 if (dns_master) 615 if (dns_master)
620 FreeDnsPrefetchResources(); 616 FreeDnsPrefetchResources();
621 } 617 }
622 618
623 } // namespace chrome_browser_net 619 } // namespace chrome_browser_net
624 620
OLDNEW
« no previous file with comments | « chrome/browser/browser_unittest.cc ('k') | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698