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" |
11 #include "base/stats_counters.h" | 11 #include "base/stats_counters.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/thread.h" | 13 #include "base/thread.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
16 #include "chrome/browser/browser_process.h" | |
17 #include "chrome/browser/net/dns_host_info.h" | 16 #include "chrome/browser/net/dns_host_info.h" |
18 #include "chrome/browser/net/referrer.h" | 17 #include "chrome/browser/net/referrer.h" |
19 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
20 #include "chrome/browser/session_startup_pref.h" | 19 #include "chrome/browser/session_startup_pref.h" |
21 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
22 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
23 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/pref_service.h" | 23 #include "chrome/common/pref_service.h" |
25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
26 #include "net/base/host_resolver.h" | 25 #include "net/base/host_resolver.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 PrefService* user_prefs) { | 414 PrefService* user_prefs) { |
416 // Use a large shutdown time so that UI tests (that instigate lookups, and | 415 // Use a large shutdown time so that UI tests (that instigate lookups, and |
417 // then try to shutdown the browser) don't instigate the CHECK about | 416 // then try to shutdown the browser) don't instigate the CHECK about |
418 // "some slaves have not finished" | 417 // "some slaves have not finished" |
419 const TimeDelta kAllowableShutdownTime(TimeDelta::FromSeconds(10)); | 418 const TimeDelta kAllowableShutdownTime(TimeDelta::FromSeconds(10)); |
420 DCHECK(NULL == dns_master); | 419 DCHECK(NULL == dns_master); |
421 if (!dns_master) { | 420 if (!dns_master) { |
422 // Have the DnsMaster issue resolve requests through a global HostResolver | 421 // Have the DnsMaster issue resolve requests through a global HostResolver |
423 // that is shared by the main URLRequestContext, and lives on the IO thread. | 422 // that is shared by the main URLRequestContext, and lives on the IO thread. |
424 dns_master = new DnsMaster(GetGlobalHostResolver(), | 423 dns_master = new DnsMaster(GetGlobalHostResolver(), |
425 g_browser_process->io_thread()->message_loop(), | |
426 max_queue_delay, max_concurrent); | 424 max_queue_delay, max_concurrent); |
427 dns_master->AddRef(); | 425 dns_master->AddRef(); |
428 // We did the initialization, so we should prime the pump, and set up | 426 // We did the initialization, so we should prime the pump, and set up |
429 // the DNS resolution system to run. | 427 // the DNS resolution system to run. |
430 Singleton<OffTheRecordObserver>::get()->Register(); | 428 Singleton<OffTheRecordObserver>::get()->Register(); |
431 | 429 |
432 if (user_prefs) { | 430 if (user_prefs) { |
433 bool enabled = user_prefs->GetBoolean(prefs::kDnsPrefetchingEnabled); | 431 bool enabled = user_prefs->GetBoolean(prefs::kDnsPrefetchingEnabled); |
434 EnableDnsPrefetch(enabled); | 432 EnableDnsPrefetch(enabled); |
435 } | 433 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 620 } |
623 } | 621 } |
624 | 622 |
625 DnsPrefetcherInit::~DnsPrefetcherInit() { | 623 DnsPrefetcherInit::~DnsPrefetcherInit() { |
626 if (dns_master) | 624 if (dns_master) |
627 FreeDnsPrefetchResources(); | 625 FreeDnsPrefetchResources(); |
628 } | 626 } |
629 | 627 |
630 } // namespace chrome_browser_net | 628 } // namespace chrome_browser_net |
631 | 629 |
OLD | NEW |