OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 value->GetAsBoolean(&is_quic_allowed_by_policy_); | 549 value->GetAsBoolean(&is_quic_allowed_by_policy_); |
550 #endif // ENABLE_CONFIGURATION_POLICY | 550 #endif // ENABLE_CONFIGURATION_POLICY |
551 | 551 |
552 BrowserThread::SetDelegate(BrowserThread::IO, this); | 552 BrowserThread::SetDelegate(BrowserThread::IO, this); |
553 } | 553 } |
554 | 554 |
555 IOThread::~IOThread() { | 555 IOThread::~IOThread() { |
556 // This isn't needed for production code, but in tests, IOThread may | 556 // This isn't needed for production code, but in tests, IOThread may |
557 // be multiply constructed. | 557 // be multiply constructed. |
558 BrowserThread::SetDelegate(BrowserThread::IO, NULL); | 558 BrowserThread::SetDelegate(BrowserThread::IO, NULL); |
559 | 559 ShutdownPrefProxyConfigTracker(); |
560 pref_proxy_config_tracker_->DetachFromPrefService(); | |
561 DCHECK(!globals_); | 560 DCHECK(!globals_); |
562 } | 561 } |
563 | 562 |
564 IOThread::Globals* IOThread::globals() { | 563 IOThread::Globals* IOThread::globals() { |
565 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 564 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
566 return globals_; | 565 return globals_; |
567 } | 566 } |
568 | 567 |
569 void IOThread::SetGlobalsForTesting(Globals* globals) { | 568 void IOThread::SetGlobalsForTesting(Globals* globals) { |
570 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 569 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 // this task to the main thread's message loop here is guaranteed to | 885 // this task to the main thread's message loop here is guaranteed to |
887 // get it onto the message loop while the IOThread object still | 886 // get it onto the message loop while the IOThread object still |
888 // exists. However, the message might not be processed on the UI | 887 // exists. However, the message might not be processed on the UI |
889 // thread until after IOThread is gone, so use a weak pointer. | 888 // thread until after IOThread is gone, so use a weak pointer. |
890 BrowserThread::PostTask(BrowserThread::UI, | 889 BrowserThread::PostTask(BrowserThread::UI, |
891 FROM_HERE, | 890 FROM_HERE, |
892 base::Bind(&IOThread::InitSystemRequestContext, | 891 base::Bind(&IOThread::InitSystemRequestContext, |
893 weak_factory_.GetWeakPtr())); | 892 weak_factory_.GetWeakPtr())); |
894 } | 893 } |
895 | 894 |
| 895 void IOThread::ShutdownPrefProxyConfigTracker() { |
| 896 if (!pref_proxy_config_tracker_) |
| 897 return; |
| 898 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 899 pref_proxy_config_tracker_.reset(); |
| 900 } |
| 901 |
896 void IOThread::CleanUp() { | 902 void IOThread::CleanUp() { |
897 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 903 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
898 | 904 |
899 #if defined(USE_NSS_CERTS) || defined(OS_IOS) | 905 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
900 net::ShutdownNSSHttpIO(); | 906 net::ShutdownNSSHttpIO(); |
901 #endif | 907 #endif |
902 | 908 |
903 system_url_request_context_getter_ = NULL; | 909 system_url_request_context_getter_ = NULL; |
904 | 910 |
905 // Release objects that the net::URLRequestContext could have been pointing | 911 // Release objects that the net::URLRequestContext could have been pointing |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 std::move(job_factory); | 1754 std::move(job_factory); |
1749 | 1755 |
1750 context->set_job_factory( | 1756 context->set_job_factory( |
1751 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1757 globals->proxy_script_fetcher_url_request_job_factory.get()); |
1752 | 1758 |
1753 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1759 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1754 // system URLRequestContext too. There's no reason this should be tied to a | 1760 // system URLRequestContext too. There's no reason this should be tied to a |
1755 // profile. | 1761 // profile. |
1756 return context; | 1762 return context; |
1757 } | 1763 } |
OLD | NEW |