Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: net/socket/ssl_client_socket_impl.cc

Issue 2621743004: Make SSLClientSocketImpl::SSLContext a leaky singleton. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ssl_client_socket_impl.h" 5 #include "net/socket/ssl_client_socket_impl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 #endif 235 #endif
236 236
237 const base::Feature kShortRecordHeaderFeature{ 237 const base::Feature kShortRecordHeaderFeature{
238 "SSLShortRecordHeader", base::FEATURE_DISABLED_BY_DEFAULT}; 238 "SSLShortRecordHeader", base::FEATURE_DISABLED_BY_DEFAULT};
239 239
240 } // namespace 240 } // namespace
241 241
242 class SSLClientSocketImpl::SSLContext { 242 class SSLClientSocketImpl::SSLContext {
243 public: 243 public:
244 static SSLContext* GetInstance() { 244 static SSLContext* GetInstance() {
245 return base::Singleton<SSLContext>::get(); 245 return base::Singleton<SSLContext,
246 base::LeakySingletonTraits<SSLContext>>::get();
246 } 247 }
247 SSL_CTX* ssl_ctx() { return ssl_ctx_.get(); } 248 SSL_CTX* ssl_ctx() { return ssl_ctx_.get(); }
248 SSLClientSessionCache* session_cache() { return &session_cache_; } 249 SSLClientSessionCache* session_cache() { return &session_cache_; }
249 250
250 SSLClientSocketImpl* GetClientSocketFromSSL(const SSL* ssl) { 251 SSLClientSocketImpl* GetClientSocketFromSSL(const SSL* ssl) {
251 DCHECK(ssl); 252 DCHECK(ssl);
252 SSLClientSocketImpl* socket = static_cast<SSLClientSocketImpl*>( 253 SSLClientSocketImpl* socket = static_cast<SSLClientSocketImpl*>(
253 SSL_get_ex_data(ssl, ssl_socket_data_index_)); 254 SSL_get_ex_data(ssl, ssl_socket_data_index_));
254 DCHECK(socket); 255 DCHECK(socket);
255 return socket; 256 return socket;
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && 2066 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED &&
2066 !certificate_requested_) { 2067 !certificate_requested_) {
2067 net_error = ERR_SSL_PROTOCOL_ERROR; 2068 net_error = ERR_SSL_PROTOCOL_ERROR;
2068 } 2069 }
2069 } 2070 }
2070 2071
2071 return net_error; 2072 return net_error;
2072 } 2073 }
2073 2074
2074 } // namespace net 2075 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698