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

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

Issue 2131883002: Clear SSLClientSessionCache on low memory notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased + removed not used method Created 4 years, 5 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 | net/ssl/ssl_client_session_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H 5 #ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_H
6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_H 6 #define NET_SSL_SSL_CLIENT_SESSION_CACHE_H
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/bind.h"
14 #include "base/containers/mru_cache.h" 15 #include "base/containers/mru_cache.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/memory_pressure_monitor.h"
16 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
17 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
18 #include "base/time/time.h" 20 #include "base/time/time.h"
19 #include "net/base/net_export.h" 21 #include "net/base/net_export.h"
20 #include "net/ssl/scoped_openssl_types.h" 22 #include "net/ssl/scoped_openssl_types.h"
21 23
22 namespace base { 24 namespace base {
23 class Clock; 25 class Clock;
24 } 26 }
25 27
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 69
68 using CacheEntryMap = 70 using CacheEntryMap =
69 base::HashingMRUCache<std::string, std::unique_ptr<CacheEntry>>; 71 base::HashingMRUCache<std::string, std::unique_ptr<CacheEntry>>;
70 72
71 // Returns true if |entry| is expired as of |now|. 73 // Returns true if |entry| is expired as of |now|.
72 bool IsExpired(CacheEntry* entry, const base::Time& now); 74 bool IsExpired(CacheEntry* entry, const base::Time& now);
73 75
74 // Removes all expired sessions from the cache. 76 // Removes all expired sessions from the cache.
75 void FlushExpiredSessions(); 77 void FlushExpiredSessions();
76 78
79 // Clear cache on low memory notifications callback.
80 void OnMemoryPressure(
81 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
82
77 std::unique_ptr<base::Clock> clock_; 83 std::unique_ptr<base::Clock> clock_;
78 Config config_; 84 Config config_;
79 CacheEntryMap cache_; 85 CacheEntryMap cache_;
80 size_t lookups_since_flush_; 86 size_t lookups_since_flush_;
81 87
82 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with 88 // TODO(davidben): After https://crbug.com/458365 is fixed, replace this with
83 // a ThreadChecker. The session cache should be single-threaded like other 89 // a ThreadChecker. The session cache should be single-threaded like other
84 // classes in net. 90 // classes in net.
85 base::Lock lock_; 91 base::Lock lock_;
86 92
93 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
94
87 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache); 95 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache);
88 }; 96 };
89 97
90 } // namespace net 98 } // namespace net
91 99
92 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H 100 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H
OLDNEW
« no previous file with comments | « no previous file | net/ssl/ssl_client_session_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698