| 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 "net/socket/client_socket_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DefaultClientSocketFactory() { | 48 DefaultClientSocketFactory() { |
| 49 if (g_use_dedicated_nss_thread) { | 49 if (g_use_dedicated_nss_thread) { |
| 50 // Use a single thread for the worker pool. | 50 // Use a single thread for the worker pool. |
| 51 worker_pool_ = new base::SequencedWorkerPool(1, "NSS SSL Thread"); | 51 worker_pool_ = new base::SequencedWorkerPool(1, "NSS SSL Thread"); |
| 52 nss_thread_task_runner_ = | 52 nss_thread_task_runner_ = |
| 53 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 53 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
| 54 worker_pool_->GetSequenceToken(), | 54 worker_pool_->GetSequenceToken(), |
| 55 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 55 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
| 56 } | 56 } |
| 57 | 57 |
| 58 CertDatabase::AddObserver(this); | 58 CertDatabase::GetInstance()->AddObserver(this); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual ~DefaultClientSocketFactory() { | 61 virtual ~DefaultClientSocketFactory() { |
| 62 // Note: This code never runs, as the factory is defined as a Leaky | 62 // Note: This code never runs, as the factory is defined as a Leaky |
| 63 // singleton. | 63 // singleton. |
| 64 CertDatabase::RemoveObserver(this); | 64 CertDatabase::GetInstance()->RemoveObserver(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void OnUserCertAdded(const X509Certificate* cert) OVERRIDE { | 67 virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE { |
| 68 ClearSSLSessionCache(); | 68 ClearSSLSessionCache(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE { | 71 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE { |
| 72 // Per wtc, we actually only need to flush when trust is reduced. | 72 // Per wtc, we actually only need to flush when trust is reduced. |
| 73 // Always flush now because OnCertTrustChanged does not tell us this. | 73 // Always flush now because OnCertTrustChanged does not tell us this. |
| 74 // See comments in ClientSocketPoolManager::OnCertTrustChanged. | 74 // See comments in ClientSocketPoolManager::OnCertTrustChanged. |
| 75 ClearSSLSessionCache(); | 75 ClearSSLSessionCache(); |
| 76 } | 76 } |
| 77 | 77 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 #if defined(OS_WIN) | 175 #if defined(OS_WIN) |
| 176 // Reflect the capability of SSLClientSocketWin. | 176 // Reflect the capability of SSLClientSocketWin. |
| 177 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); | 177 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); |
| 178 #elif defined(OS_MACOSX) | 178 #elif defined(OS_MACOSX) |
| 179 // Reflect the capability of SSLClientSocketMac. | 179 // Reflect the capability of SSLClientSocketMac. |
| 180 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); | 180 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); |
| 181 #endif | 181 #endif |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace net | 184 } // namespace net |
| OLD | NEW |