| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Per wtc, we actually only need to flush when trust is reduced. | 41 // Per wtc, we actually only need to flush when trust is reduced. |
| 42 // Always flush now because OnCACertChanged does not tell us this. | 42 // Always flush now because OnCACertChanged does not tell us this. |
| 43 // See comments in ClientSocketPoolManager::OnCACertChanged. | 43 // See comments in ClientSocketPoolManager::OnCACertChanged. |
| 44 ClearSSLSessionCache(); | 44 ClearSSLSessionCache(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 47 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
| 48 DatagramSocket::BindType bind_type, | 48 DatagramSocket::BindType bind_type, |
| 49 const RandIntCallback& rand_int_cb, | 49 const RandIntCallback& rand_int_cb, |
| 50 NetLog* net_log, | 50 NetLog* net_log, |
| 51 const NetLog::Source& source) override { | 51 const NetLogSource& source) override { |
| 52 return std::unique_ptr<DatagramClientSocket>( | 52 return std::unique_ptr<DatagramClientSocket>( |
| 53 new UDPClientSocket(bind_type, rand_int_cb, net_log, source)); | 53 new UDPClientSocket(bind_type, rand_int_cb, net_log, source)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 std::unique_ptr<StreamSocket> CreateTransportClientSocket( | 56 std::unique_ptr<StreamSocket> CreateTransportClientSocket( |
| 57 const AddressList& addresses, | 57 const AddressList& addresses, |
| 58 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 58 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
| 59 NetLog* net_log, | 59 NetLog* net_log, |
| 60 const NetLog::Source& source) override { | 60 const NetLogSource& source) override { |
| 61 return std::unique_ptr<StreamSocket>(new TCPClientSocket( | 61 return std::unique_ptr<StreamSocket>(new TCPClientSocket( |
| 62 addresses, std::move(socket_performance_watcher), net_log, source)); | 62 addresses, std::move(socket_performance_watcher), net_log, source)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( | 65 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 66 std::unique_ptr<ClientSocketHandle> transport_socket, | 66 std::unique_ptr<ClientSocketHandle> transport_socket, |
| 67 const HostPortPair& host_and_port, | 67 const HostPortPair& host_and_port, |
| 68 const SSLConfig& ssl_config, | 68 const SSLConfig& ssl_config, |
| 69 const SSLClientSocketContext& context) override { | 69 const SSLClientSocketContext& context) override { |
| 70 return std::unique_ptr<SSLClientSocket>(new SSLClientSocketImpl( | 70 return std::unique_ptr<SSLClientSocket>(new SSLClientSocketImpl( |
| 71 std::move(transport_socket), host_and_port, ssl_config, context)); | 71 std::move(transport_socket), host_and_port, ssl_config, context)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ClearSSLSessionCache() override { SSLClientSocket::ClearSessionCache(); } | 74 void ClearSSLSessionCache() override { SSLClientSocket::ClearSessionCache(); } |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 static base::LazyInstance<DefaultClientSocketFactory>::Leaky | 77 static base::LazyInstance<DefaultClientSocketFactory>::Leaky |
| 78 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; | 78 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 // static | 82 // static |
| 83 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 83 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
| 84 return g_default_client_socket_factory.Pointer(); | 84 return g_default_client_socket_factory.Pointer(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace net | 87 } // namespace net |
| OLD | NEW |