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

Side by Side Diff: net/ssl/ssl_client_session_cache_impl.h

Issue 1921563003: Renaming _openssl files to _impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H 5 #ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_IMPL_H
6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H 6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_IMPL_H
davidben 2016/04/25 16:14:19 I'd drop the "impl" altogether since we're not imp
svaldez 2016/04/25 20:26:35 Done.
7 7
8 #include <openssl/ssl.h> 8 #include <openssl/ssl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/containers/mru_cache.h" 14 #include "base/containers/mru_cache.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "net/base/net_export.h" 19 #include "net/base/net_export.h"
20 #include "net/ssl/scoped_openssl_types.h" 20 #include "net/ssl/scoped_openssl_types.h"
21 21
22 namespace base { 22 namespace base {
23 class Clock; 23 class Clock;
24 } 24 }
25 25
26 namespace net { 26 namespace net {
27 27
28 class NET_EXPORT SSLClientSessionCacheOpenSSL { 28 class NET_EXPORT SSLClientSessionCacheImpl {
29 public: 29 public:
30 struct Config { 30 struct Config {
31 // The maximum number of entries in the cache. 31 // The maximum number of entries in the cache.
32 size_t max_entries = 1024; 32 size_t max_entries = 1024;
33 // The number of calls to Lookup before a new check for expired sessions. 33 // The number of calls to Lookup before a new check for expired sessions.
34 size_t expiration_check_count = 256; 34 size_t expiration_check_count = 256;
35 // How long each session should last. 35 // How long each session should last.
36 base::TimeDelta timeout = base::TimeDelta::FromHours(1); 36 base::TimeDelta timeout = base::TimeDelta::FromHours(1);
37 }; 37 };
38 38
39 explicit SSLClientSessionCacheOpenSSL(const Config& config); 39 explicit SSLClientSessionCacheImpl(const Config& config);
40 ~SSLClientSessionCacheOpenSSL(); 40 ~SSLClientSessionCacheImpl();
41 41
42 size_t size() const; 42 size_t size() const;
43 43
44 // Returns the session associated with |cache_key| and moves it to the front 44 // Returns the session associated with |cache_key| and moves it to the front
45 // of the MRU list. Returns nullptr if there is none. 45 // of the MRU list. Returns nullptr if there is none.
46 ScopedSSL_SESSION Lookup(const std::string& cache_key); 46 ScopedSSL_SESSION Lookup(const std::string& cache_key);
47 47
48 // Inserts |session| into the cache at |cache_key|. If there is an existing 48 // Inserts |session| into the cache at |cache_key|. If there is an existing
49 // one, it is released. Every |expiration_check_count| calls, the cache is 49 // one, it is released. Every |expiration_check_count| calls, the cache is
50 // checked for stale entries. 50 // checked for stale entries.
(...skipping 26 matching lines...) Expand all
77 std::unique_ptr<base::Clock> clock_; 77 std::unique_ptr<base::Clock> clock_;
78 Config config_; 78 Config config_;
79 CacheEntryMap cache_; 79 CacheEntryMap cache_;
80 size_t lookups_since_flush_; 80 size_t lookups_since_flush_;
81 81
82 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with 82 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with
83 // a ThreadChecker. The session cache should be single-threaded like other 83 // a ThreadChecker. The session cache should be single-threaded like other
84 // classes in net. 84 // classes in net.
85 base::Lock lock_; 85 base::Lock lock_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCacheOpenSSL); 87 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCacheImpl);
88 }; 88 };
89 89
90 } // namespace net 90 } // namespace net
91 91
92 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H 92 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698