| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |