| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 if (CommandLine::ForCurrentProcess()->HasSwitch( | 337 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 338 switches::kEnablePagePrerender)) { | 338 switches::kEnablePagePrerender)) { |
| 339 prerender_interceptor_.reset( | 339 prerender_interceptor_.reset( |
| 340 new chrome_browser_net::PrerenderInterceptor()); | 340 new chrome_browser_net::PrerenderInterceptor()); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 void IOThread::CleanUp() { | 344 void IOThread::CleanUp() { |
| 345 // Step 1: Kill all things that might be holding onto | 345 // Step 1: Kill all things that might be holding onto |
| 346 // URLRequest/URLRequestContexts. | 346 // net::URLRequest/URLRequestContexts. |
| 347 | 347 |
| 348 #if defined(USE_NSS) | 348 #if defined(USE_NSS) |
| 349 net::ShutdownOCSP(); | 349 net::ShutdownOCSP(); |
| 350 #endif // defined(USE_NSS) | 350 #endif // defined(USE_NSS) |
| 351 | 351 |
| 352 // Destroy all URLRequests started by URLFetchers. | 352 // Destroy all URLRequests started by URLFetchers. |
| 353 URLFetcher::CancelAll(); | 353 URLFetcher::CancelAll(); |
| 354 | 354 |
| 355 // Break any cycles between the ProxyScriptFetcher and URLRequestContext. | 355 // Break any cycles between the ProxyScriptFetcher and URLRequestContext. |
| 356 for (ProxyScriptFetchers::const_iterator it = fetchers_.begin(); | 356 for (ProxyScriptFetchers::const_iterator it = fetchers_.begin(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // TODO(eroman): get rid of this special case for 39723. If we could instead | 430 // TODO(eroman): get rid of this special case for 39723. If we could instead |
| 431 // have a method that runs after the message loop destruction observers have | 431 // have a method that runs after the message loop destruction observers have |
| 432 // run, but before the message loop itself is destroyed, we could safely | 432 // run, but before the message loop itself is destroyed, we could safely |
| 433 // combine the two cleanups. | 433 // combine the two cleanups. |
| 434 deferred_net_log_to_delete_.reset(); | 434 deferred_net_log_to_delete_.reset(); |
| 435 | 435 |
| 436 // This will delete the |notification_service_|. Make sure it's done after | 436 // This will delete the |notification_service_|. Make sure it's done after |
| 437 // anything else can reference it. | 437 // anything else can reference it. |
| 438 BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction(); | 438 BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction(); |
| 439 | 439 |
| 440 // URLRequest instances must NOT outlive the IO thread. | 440 // net::URLRequest instances must NOT outlive the IO thread. |
| 441 // | 441 // |
| 442 // To allow for URLRequests to be deleted from | 442 // To allow for URLRequests to be deleted from |
| 443 // MessageLoop::DestructionObserver this check has to happen after CleanUp | 443 // MessageLoop::DestructionObserver this check has to happen after CleanUp |
| 444 // (which runs before DestructionObservers). | 444 // (which runs before DestructionObservers). |
| 445 base::debug::LeakTracker<URLRequest>::CheckForLeaks(); | 445 base::debug::LeakTracker<net::URLRequest>::CheckForLeaks(); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // static | 448 // static |
| 449 void IOThread::RegisterPrefs(PrefService* local_state) { | 449 void IOThread::RegisterPrefs(PrefService* local_state) { |
| 450 local_state->RegisterStringPref(prefs::kAuthSchemes, | 450 local_state->RegisterStringPref(prefs::kAuthSchemes, |
| 451 "basic,digest,ntlm,negotiate"); | 451 "basic,digest,ntlm,negotiate"); |
| 452 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, | 452 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, |
| 453 false); | 453 false); |
| 454 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 454 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
| 455 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); | 455 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 net::HostCache* host_cache = | 524 net::HostCache* host_cache = |
| 525 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); | 525 globals_->host_resolver.get()->GetAsHostResolverImpl()->cache(); |
| 526 if (host_cache) | 526 if (host_cache) |
| 527 host_cache->clear(); | 527 host_cache->clear(); |
| 528 } | 528 } |
| 529 // Clear all of the passively logged data. | 529 // Clear all of the passively logged data. |
| 530 // TODO(eroman): this is a bit heavy handed, really all we need to do is | 530 // TODO(eroman): this is a bit heavy handed, really all we need to do is |
| 531 // clear the data pertaining to off the record context. | 531 // clear the data pertaining to off the record context. |
| 532 globals_->net_log->passive_collector()->Clear(); | 532 globals_->net_log->passive_collector()->Clear(); |
| 533 } | 533 } |
| OLD | NEW |