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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // tests, which may create and tear down the current thread's TaskRunner | 97 // tests, which may create and tear down the current thread's TaskRunner |
98 // between each test. Because the DefaultClientSocketFactory is leaky, it | 98 // between each test. Because the DefaultClientSocketFactory is leaky, it |
99 // may span multiple tests, and thus the current task runner may change | 99 // may span multiple tests, and thus the current task runner may change |
100 // from call to call. | 100 // from call to call. |
101 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( | 101 scoped_refptr<base::SequencedTaskRunner> nss_task_runner( |
102 nss_thread_task_runner_); | 102 nss_thread_task_runner_); |
103 if (!nss_task_runner.get()) | 103 if (!nss_task_runner.get()) |
104 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); | 104 nss_task_runner = base::ThreadTaskRunnerHandle::Get(); |
105 | 105 |
106 #if defined(USE_OPENSSL) | 106 #if defined(USE_OPENSSL) |
107 return scoped_ptr<SSLClientSocket>( | 107 return scoped_ptr<SSLClientSocket>(new SSLClientSocketOpenSSL( |
108 new SSLClientSocketOpenSSL(transport_socket.Pass(), host_and_port, | 108 transport_socket.Pass(), host_and_port, ssl_config, context)); |
109 ssl_config, context)); | |
110 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) | 109 #elif defined(USE_NSS) || defined(OS_MACOSX) || defined(OS_WIN) |
111 return scoped_ptr<SSLClientSocket>( | 110 return scoped_ptr<SSLClientSocket>( |
112 new SSLClientSocketNSS(nss_task_runner.get(), | 111 new SSLClientSocketNSS(nss_task_runner.get(), |
113 transport_socket.Pass(), | 112 transport_socket.Pass(), |
114 host_and_port, | 113 host_and_port, |
115 ssl_config, | 114 ssl_config, |
116 context)); | 115 context)); |
117 #else | 116 #else |
118 NOTIMPLEMENTED(); | 117 NOTIMPLEMENTED(); |
119 return scoped_ptr<SSLClientSocket>(); | 118 return scoped_ptr<SSLClientSocket>(); |
(...skipping 13 matching lines...) Expand all Loading... |
133 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; | 132 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; |
134 | 133 |
135 } // namespace | 134 } // namespace |
136 | 135 |
137 // static | 136 // static |
138 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 137 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
139 return g_default_client_socket_factory.Pointer(); | 138 return g_default_client_socket_factory.Pointer(); |
140 } | 139 } |
141 | 140 |
142 } // namespace net | 141 } // namespace net |
OLD | NEW |