| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 422 } |
| 423 | 423 |
| 424 //------------------------------------------------------------------------------ | 424 //------------------------------------------------------------------------------ |
| 425 | 425 |
| 426 // Host resolver shared by DNS prefetcher, and the main URLRequestContext. | 426 // Host resolver shared by DNS prefetcher, and the main URLRequestContext. |
| 427 static net::HostResolver* global_host_resolver = NULL; | 427 static net::HostResolver* global_host_resolver = NULL; |
| 428 | 428 |
| 429 net::HostResolver* GetGlobalHostResolver() { | 429 net::HostResolver* GetGlobalHostResolver() { |
| 430 // Called from UI thread. | 430 // Called from UI thread. |
| 431 if (!global_host_resolver) { | 431 if (!global_host_resolver) { |
| 432 // TODO(eroman): | |
| 433 #if 0 | |
| 434 static const size_t kMaxHostCacheEntries = 100; | 432 static const size_t kMaxHostCacheEntries = 100; |
| 435 static const size_t kHostCacheExpirationSeconds = 60; // 1 minute. | 433 static const size_t kHostCacheExpirationSeconds = 60; // 1 minute. |
| 436 | 434 |
| 437 global_host_resolver = new net::HostResolver( | 435 global_host_resolver = new net::HostResolver( |
| 438 kMaxHostCacheEntries, kHostCacheExpirationSeconds * 1000); | 436 kMaxHostCacheEntries, kHostCacheExpirationSeconds * 1000); |
| 439 #endif | |
| 440 } | 437 } |
| 441 return global_host_resolver; | 438 return global_host_resolver; |
| 442 } | 439 } |
| 443 | 440 |
| 444 void FreeGlobalHostResolver() { | 441 void FreeGlobalHostResolver() { |
| 445 if (global_host_resolver) { | 442 if (global_host_resolver) { |
| 446 // Called from IO thread. | 443 // Called from IO thread. |
| 447 DCHECK_EQ(MessageLoop::current(), | |
| 448 g_browser_process->io_thread()->message_loop()); | |
| 449 delete global_host_resolver; | 444 delete global_host_resolver; |
| 450 global_host_resolver = NULL; | 445 global_host_resolver = NULL; |
| 451 } | 446 } |
| 452 } | 447 } |
| 453 | 448 |
| 454 //------------------------------------------------------------------------------ | 449 //------------------------------------------------------------------------------ |
| 455 // Functions to handle saving of hostnames from one session to the next, to | 450 // Functions to handle saving of hostnames from one session to the next, to |
| 456 // expedite startup times. | 451 // expedite startup times. |
| 457 | 452 |
| 458 void SaveHostNamesForNextStartup(PrefService* local_state) { | 453 void SaveHostNamesForNextStartup(PrefService* local_state) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 dns_master->DeserializeReferrers(*referral_list); | 515 dns_master->DeserializeReferrers(*referral_list); |
| 521 } | 516 } |
| 522 | 517 |
| 523 void TrimSubresourceReferrers() { | 518 void TrimSubresourceReferrers() { |
| 524 if (NULL == dns_master) | 519 if (NULL == dns_master) |
| 525 return; | 520 return; |
| 526 dns_master->TrimReferrers(); | 521 dns_master->TrimReferrers(); |
| 527 } | 522 } |
| 528 | 523 |
| 529 } // namespace chrome_browser_net | 524 } // namespace chrome_browser_net |
| OLD | NEW |