OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 10 #include "base/bind.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #if defined(USE_NSS) | 59 #if defined(USE_NSS) |
60 #include "net/ocsp/nss_ocsp.h" | 60 #include "net/ocsp/nss_ocsp.h" |
61 #endif // defined(USE_NSS) | 61 #endif // defined(USE_NSS) |
62 | 62 |
63 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
64 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 64 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
65 #endif // defined(OS_CHROMEOS) | 65 #endif // defined(OS_CHROMEOS) |
66 | 66 |
67 using content::BrowserThread; | 67 using content::BrowserThread; |
68 | 68 |
| 69 class SafeBrowsingURLRequestContext; |
| 70 |
69 // The IOThread object must outlive any tasks posted to the IO thread before the | 71 // The IOThread object must outlive any tasks posted to the IO thread before the |
70 // Quit task, so base::Bind() calls are not refcounted. | 72 // Quit task, so base::Bind() calls are not refcounted. |
71 | 73 |
72 namespace { | 74 namespace { |
73 | 75 |
74 // Custom URLRequestContext used by requests which aren't associated with a | 76 // Custom URLRequestContext used by requests which aren't associated with a |
75 // particular profile. We need to use a subclass of URLRequestContext in order | 77 // particular profile. We need to use a subclass of URLRequestContext in order |
76 // to provide the correct User-Agent. | 78 // to provide the correct User-Agent. |
77 class URLRequestContextWithUserAgent : public net::URLRequestContext { | 79 class URLRequestContextWithUserAgent : public net::URLRequestContext { |
78 public: | 80 public: |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 base::Bind(&IOThread::InitSystemRequestContext, | 468 base::Bind(&IOThread::InitSystemRequestContext, |
467 weak_factory_.GetWeakPtr())); | 469 weak_factory_.GetWeakPtr())); |
468 | 470 |
469 // We constructed the weak pointer on the IO thread but it will be | 471 // We constructed the weak pointer on the IO thread but it will be |
470 // used on the UI thread. Call this to avoid a thread checker | 472 // used on the UI thread. Call this to avoid a thread checker |
471 // error. | 473 // error. |
472 weak_factory_.DetachFromThread(); | 474 weak_factory_.DetachFromThread(); |
473 } | 475 } |
474 | 476 |
475 void IOThread::CleanUp() { | 477 void IOThread::CleanUp() { |
| 478 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
| 479 |
476 delete sdch_manager_; | 480 delete sdch_manager_; |
477 sdch_manager_ = NULL; | 481 sdch_manager_ = NULL; |
478 | 482 |
479 #if defined(USE_NSS) | 483 #if defined(USE_NSS) |
480 net::ShutdownOCSP(); | 484 net::ShutdownOCSP(); |
481 #endif // defined(USE_NSS) | 485 #endif // defined(USE_NSS) |
482 | 486 |
483 system_url_request_context_getter_ = NULL; | 487 system_url_request_context_getter_ = NULL; |
484 | 488 |
485 // Release objects that the net::URLRequestContext could have been pointing | 489 // Release objects that the net::URLRequestContext could have been pointing |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 system_params.network_delegate = globals_->system_network_delegate.get(); | 618 system_params.network_delegate = globals_->system_network_delegate.get(); |
615 system_params.net_log = net_log_; | 619 system_params.net_log = net_log_; |
616 globals_->system_http_transaction_factory.reset( | 620 globals_->system_http_transaction_factory.reset( |
617 new net::HttpNetworkLayer( | 621 new net::HttpNetworkLayer( |
618 new net::HttpNetworkSession(system_params))); | 622 new net::HttpNetworkSession(system_params))); |
619 globals_->system_ftp_transaction_factory.reset( | 623 globals_->system_ftp_transaction_factory.reset( |
620 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 624 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
621 globals_->system_request_context = | 625 globals_->system_request_context = |
622 ConstructSystemRequestContext(globals_, net_log_); | 626 ConstructSystemRequestContext(globals_, net_log_); |
623 } | 627 } |
OLD | NEW |