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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_session_cache_openssl.h" 5 #include "net/socket/ssl_session_cache_openssl.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include <openssl/rand.h> 10 #include <openssl/rand.h>
11 #include <openssl/ssl.h> 11 #include <openssl/ssl.h>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 namespace { 20 namespace {
21 21
22 // A helper class to lazily create a new EX_DATA index to map SSL_CTX handles 22 // A helper class to lazily create a new EX_DATA index to map SSL_CTX handles
23 // to their corresponding SSLSessionCacheOpenSSLImpl object. 23 // to their corresponding SSLSessionCacheOpenSSLImpl object.
24 class SSLContextExIndex { 24 class SSLContextExIndex {
25 public: 25 public:
26 SSLContextExIndex() { 26 SSLContextExIndex() {
27 context_index_ = SSL_CTX_get_ex_new_index(0, NULL, NULL, NULL, NULL); 27 context_index_ = SSL_CTX_get_ex_new_index(0, NULL, NULL, NULL, NULL);
28 DCHECK_NE(-1, context_index_); 28 DCHECK_NE(-1, context_index_);
29 session_index_ = SSL_SESSION_get_ex_new_index(0, NULL, NULL, NULL, NULL); 29 session_index_ = SSL_SESSION_get_ex_new_index(0, NULL, NULL, NULL, NULL);
30 DCHECK_NE(-1, session_index_); 30 DCHECK_NE(-1, session_index_);
31 } 31 }
32 32
33 int context_index() const { return context_index_; } 33 int context_index() const { return context_index_; }
34 int session_index() const { return session_index_; } 34 int session_index() const { return session_index_; }
35 35
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // or SSL_CTX_set_ex_data(). 471 // or SSL_CTX_set_ex_data().
472 base::Lock lock_; // Protects access to containers below. 472 base::Lock lock_; // Protects access to containers below.
473 473
474 MRUSessionList ordering_; 474 MRUSessionList ordering_;
475 KeyIndex key_index_; 475 KeyIndex key_index_;
476 SessionIdIndex id_index_; 476 SessionIdIndex id_index_;
477 477
478 size_t expiration_check_; 478 size_t expiration_check_;
479 }; 479 };
480 480
481 SSLSessionCacheOpenSSL::~SSLSessionCacheOpenSSL() { delete impl_; } 481 SSLSessionCacheOpenSSL::~SSLSessionCacheOpenSSL() {
482 delete impl_;
483 }
482 484
483 size_t SSLSessionCacheOpenSSL::size() const { return impl_->size(); } 485 size_t SSLSessionCacheOpenSSL::size() const {
486 return impl_->size();
487 }
484 488
485 void SSLSessionCacheOpenSSL::Reset(SSL_CTX* ctx, const Config& config) { 489 void SSLSessionCacheOpenSSL::Reset(SSL_CTX* ctx, const Config& config) {
486 if (impl_) 490 if (impl_)
487 delete impl_; 491 delete impl_;
488 492
489 impl_ = new SSLSessionCacheOpenSSLImpl(ctx, config); 493 impl_ = new SSLSessionCacheOpenSSLImpl(ctx, config);
490 } 494 }
491 495
492 bool SSLSessionCacheOpenSSL::SetSSLSession(SSL* ssl) { 496 bool SSLSessionCacheOpenSSL::SetSSLSession(SSL* ssl) {
493 return impl_->SetSSLSession(ssl); 497 return impl_->SetSSLSession(ssl);
494 } 498 }
495 499
496 bool SSLSessionCacheOpenSSL::SetSSLSessionWithKey( 500 bool SSLSessionCacheOpenSSL::SetSSLSessionWithKey(
497 SSL* ssl, 501 SSL* ssl,
498 const std::string& cache_key) { 502 const std::string& cache_key) {
499 return impl_->SetSSLSessionWithKey(ssl, cache_key); 503 return impl_->SetSSLSessionWithKey(ssl, cache_key);
500 } 504 }
501 505
502 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) { 506 void SSLSessionCacheOpenSSL::MarkSSLSessionAsGood(SSL* ssl) {
503 return impl_->MarkSSLSessionAsGood(ssl); 507 return impl_->MarkSSLSessionAsGood(ssl);
504 } 508 }
505 509
506 void SSLSessionCacheOpenSSL::Flush() { impl_->Flush(); } 510 void SSLSessionCacheOpenSSL::Flush() {
511 impl_->Flush();
512 }
507 513
508 } // namespace net 514 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698