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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // false or if the dedicated NSS thread failed to start. If so, cause NSS | 91 // false or if the dedicated NSS thread failed to start. If so, cause NSS |
92 // functions to execute on the current task runner. | 92 // functions to execute on the current task runner. |
93 // | 93 // |
94 // Note: The current task runner is obtained on each call due to unit | 94 // Note: The current task runner is obtained on each call due to unit |
95 // tests, which may create and tear down the current thread's TaskRunner | 95 // tests, which may create and tear down the current thread's TaskRunner |
96 // between each test. Because the DefaultClientSocketFactory is leaky, it | 96 // between each test. Because the DefaultClientSocketFactory is leaky, it |
97 // may span multiple tests, and thus the current task runner may change | 97 // may span multiple tests, and thus the current task runner may change |
98 // from call to call. | 98 // from call to call. |
99 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( | 99 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( |
100 nss_thread_task_runner_); | 100 nss_thread_task_runner_); |
101 if (!nss_task_runner) | 101 if (!nss_task_runner.get()) |
102 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); | 102 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); |
103 | 103 |
104 #if defined(USE_OPENSSL) | 104 #if defined(USE_OPENSSL) |
105 return new SSLClientSocketOpenSSL(transport_socket, host_and_port, | 105 return new SSLClientSocketOpenSSL(transport_socket, host_and_port, |
106 ssl_config, context); | 106 ssl_config, context); |
107 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) | 107 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) |
108 return new SSLClientSocketNSS(nss_task_runner, transport_socket, | 108 return new SSLClientSocketNSS(nss_task_runner.get(), |
109 host_and_port, ssl_config, context); | 109 transport_socket, |
| 110 host_and_port, |
| 111 ssl_config, |
| 112 context); |
110 #else | 113 #else |
111 NOTIMPLEMENTED(); | 114 NOTIMPLEMENTED(); |
112 return NULL; | 115 return NULL; |
113 #endif | 116 #endif |
114 } | 117 } |
115 | 118 |
116 virtual void ClearSSLSessionCache() OVERRIDE { | 119 virtual void ClearSSLSessionCache() OVERRIDE { |
117 SSLClientSocket::ClearSessionCache(); | 120 SSLClientSocket::ClearSessionCache(); |
118 } | 121 } |
119 | 122 |
(...skipping 18 matching lines...) Expand all Loading... |
138 return CreateSSLClientSocket(socket_handle, host_and_port, ssl_config, | 141 return CreateSSLClientSocket(socket_handle, host_and_port, ssl_config, |
139 context); | 142 context); |
140 } | 143 } |
141 | 144 |
142 // static | 145 // static |
143 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 146 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
144 return g_default_client_socket_factory.Pointer(); | 147 return g_default_client_socket_factory.Pointer(); |
145 } | 148 } |
146 | 149 |
147 } // namespace net | 150 } // namespace net |
OLD | NEW |