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

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

Issue 2541093003: Instrument SSL sockets using MemoryDumpProvider (Closed)
Patch Set: Fix flaky test Created 4 years 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 | « net/socket/stream_socket.h ('k') | 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 <stddef.h> 8 #include <stddef.h>
9 #include <time.h> 9 #include <time.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/bind.h"
15 #include "base/containers/mru_cache.h" 15 #include "base/containers/mru_cache.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/memory_coordinator_client.h" 17 #include "base/memory/memory_coordinator_client.h"
18 #include "base/memory/memory_pressure_monitor.h" 18 #include "base/memory/memory_pressure_monitor.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/threading/thread_checker.h" 20 #include "base/threading/thread_checker.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "net/base/net_export.h" 22 #include "net/base/net_export.h"
23 #include "third_party/boringssl/src/include/openssl/base.h" 23 #include "third_party/boringssl/src/include/openssl/base.h"
24 24
25 namespace base { 25 namespace base {
26 class Clock; 26 class Clock;
27 namespace trace_event {
28 class ProcessMemoryDump;
29 }
27 } 30 }
28 31
29 namespace net { 32 namespace net {
30 33
31 class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient { 34 class NET_EXPORT SSLClientSessionCache : public base::MemoryCoordinatorClient {
32 public: 35 public:
33 struct Config { 36 struct Config {
34 // The maximum number of entries in the cache. 37 // The maximum number of entries in the cache.
35 size_t max_entries = 1024; 38 size_t max_entries = 1024;
36 // The number of calls to Lookup before a new check for expired sessions. 39 // The number of calls to Lookup before a new check for expired sessions.
(...skipping 12 matching lines...) Expand all
49 // Inserts |session| into the cache at |cache_key|. If there is an existing 52 // Inserts |session| into the cache at |cache_key|. If there is an existing
50 // one, it is released. Every |expiration_check_count| calls, the cache is 53 // one, it is released. Every |expiration_check_count| calls, the cache is
51 // checked for stale entries. 54 // checked for stale entries.
52 void Insert(const std::string& cache_key, SSL_SESSION* session); 55 void Insert(const std::string& cache_key, SSL_SESSION* session);
53 56
54 // Removes all entries from the cache. 57 // Removes all entries from the cache.
55 void Flush(); 58 void Flush();
56 59
57 void SetClockForTesting(std::unique_ptr<base::Clock> clock); 60 void SetClockForTesting(std::unique_ptr<base::Clock> clock);
58 61
62 // Dumps memory allocation stats. |pmd| is the ProcessMemoryDump of the
63 // browser process.
64 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd);
65
59 private: 66 private:
60 // base::MemoryCoordinatorClient implementation: 67 // base::MemoryCoordinatorClient implementation:
61 void OnMemoryStateChange(base::MemoryState state) override; 68 void OnMemoryStateChange(base::MemoryState state) override;
62 69
63 // Returns true if |entry| is expired as of |now|. 70 // Returns true if |entry| is expired as of |now|.
64 bool IsExpired(SSL_SESSION* session, time_t now); 71 bool IsExpired(SSL_SESSION* session, time_t now);
65 72
66 // Removes all expired sessions from the cache. 73 // Removes all expired sessions from the cache.
67 void FlushExpiredSessions(); 74 void FlushExpiredSessions();
68 75
(...skipping 12 matching lines...) Expand all
81 base::Lock lock_; 88 base::Lock lock_;
82 89
83 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 90 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
84 91
85 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache); 92 DISALLOW_COPY_AND_ASSIGN(SSLClientSessionCache);
86 }; 93 };
87 94
88 } // namespace net 95 } // namespace net
89 96
90 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H 97 #endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H
OLDNEW
« no previous file with comments | « net/socket/stream_socket.h ('k') | net/ssl/ssl_client_session_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698