OLD | NEW |
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_OPENSSL_H |
6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H | 6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H |
7 | 7 |
8 #include <openssl/ssl.h> | 8 #include <openssl/ssl.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/containers/mru_cache.h" | 12 #include "base/containers/mru_cache.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/synchronization/lock.h" |
15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
18 #include "net/ssl/scoped_openssl_types.h" | 19 #include "net/ssl/scoped_openssl_types.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class Clock; | 22 class Clock; |
22 } | 23 } |
23 | 24 |
24 namespace net { | 25 namespace net { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool IsExpired(CacheEntry* entry, const base::Time& now); | 76 bool IsExpired(CacheEntry* entry, const base::Time& now); |
76 | 77 |
77 // Removes all expired sessions from the cache. | 78 // Removes all expired sessions from the cache. |
78 void FlushExpiredSessions(); | 79 void FlushExpiredSessions(); |
79 | 80 |
80 scoped_ptr<base::Clock> clock_; | 81 scoped_ptr<base::Clock> clock_; |
81 Config config_; | 82 Config config_; |
82 CacheEntryMap cache_; | 83 CacheEntryMap cache_; |
83 size_t lookups_since_flush_; | 84 size_t lookups_since_flush_; |
84 | 85 |
85 base::ThreadChecker thread_checker_; | 86 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with |
| 87 // a ThreadChecker. The session cache should be single-threaded like other |
| 88 // classes in net. |
| 89 base::Lock lock_; |
86 | 90 |
87 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCacheOpenSSL); | 91 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCacheOpenSSL); |
88 }; | 92 }; |
89 | 93 |
90 } // namespace net | 94 } // namespace net |
91 | 95 |
92 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H | 96 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_OPENSSL_H |
OLD | NEW |