| 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 cert_db; |
| 59 cert_db.AddObserver(this); |
| 59 } | 60 } |
| 60 | 61 |
| 61 virtual ~DefaultClientSocketFactory() { | 62 virtual ~DefaultClientSocketFactory() { |
| 62 // Note: This code never runs, as the factory is defined as a Leaky | 63 // Note: This code never runs, as the factory is defined as a Leaky |
| 63 // singleton. | 64 // singleton. |
| 64 CertDatabase::RemoveObserver(this); | 65 CertDatabase cert_db; |
| 66 cert_db.RemoveObserver(this); |
| 65 } | 67 } |
| 66 | 68 |
| 67 virtual void OnUserCertAdded(const X509Certificate* cert) OVERRIDE { | 69 virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE { |
| 68 ClearSSLSessionCache(); | 70 ClearSSLSessionCache(); |
| 69 } | 71 } |
| 70 | 72 |
| 71 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE { | 73 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE { |
| 72 // Per wtc, we actually only need to flush when trust is reduced. | 74 // Per wtc, we actually only need to flush when trust is reduced. |
| 73 // Always flush now because OnCertTrustChanged does not tell us this. | 75 // Always flush now because OnCertTrustChanged does not tell us this. |
| 74 // See comments in ClientSocketPoolManager::OnCertTrustChanged. | 76 // See comments in ClientSocketPoolManager::OnCertTrustChanged. |
| 75 ClearSSLSessionCache(); | 77 ClearSSLSessionCache(); |
| 76 } | 78 } |
| 77 | 79 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
| 176 // Reflect the capability of SSLClientSocketWin. | 178 // Reflect the capability of SSLClientSocketWin. |
| 177 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); | 179 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); |
| 178 #elif defined(OS_MACOSX) | 180 #elif defined(OS_MACOSX) |
| 179 // Reflect the capability of SSLClientSocketMac. | 181 // Reflect the capability of SSLClientSocketMac. |
| 180 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); | 182 SSLConfigService::SetDefaultVersionMax(SSL_PROTOCOL_VERSION_TLS1); |
| 181 #endif | 183 #endif |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace net | 186 } // namespace net |
| OLD | NEW |