| 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 #include "net/ssl/ssl_client_session_cache.h" | 5 #include "net/ssl/ssl_client_session_cache.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/containers/flat_set.h" | 9 #include "base/containers/flat_set.h" |
| 10 #include "base/memory/memory_coordinator_client_registry.h" | 10 #include "base/memory/memory_coordinator_client_registry.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 cache_.Clear(); | 100 cache_.Clear(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SSLClientSessionCache::SetClockForTesting( | 103 void SSLClientSessionCache::SetClockForTesting( |
| 104 std::unique_ptr<base::Clock> clock) { | 104 std::unique_ptr<base::Clock> clock) { |
| 105 clock_ = std::move(clock); | 105 clock_ = std::move(clock); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool SSLClientSessionCache::IsExpired(SSL_SESSION* session, time_t now) { | 108 bool SSLClientSessionCache::IsExpired(SSL_SESSION* session, time_t now) { |
| 109 return now < SSL_SESSION_get_time(session) || | 109 if (now < 0) |
| 110 now >= | 110 return true; |
| 111 uint64_t now_u64 = static_cast<uint64_t>(now); |
| 112 return now_u64 < SSL_SESSION_get_time(session) || |
| 113 now_u64 >= |
| 111 SSL_SESSION_get_time(session) + SSL_SESSION_get_timeout(session); | 114 SSL_SESSION_get_time(session) + SSL_SESSION_get_timeout(session); |
| 112 } | 115 } |
| 113 | 116 |
| 114 void SSLClientSessionCache::DumpMemoryStats( | 117 void SSLClientSessionCache::DumpMemoryStats( |
| 115 base::trace_event::ProcessMemoryDump* pmd) { | 118 base::trace_event::ProcessMemoryDump* pmd) { |
| 116 std::string absolute_name = "net/ssl_session_cache"; | 119 std::string absolute_name = "net/ssl_session_cache"; |
| 117 base::trace_event::MemoryAllocatorDump* cache_dump = | 120 base::trace_event::MemoryAllocatorDump* cache_dump = |
| 118 pmd->GetAllocatorDump(absolute_name); | 121 pmd->GetAllocatorDump(absolute_name); |
| 119 // This method can be reached from different URLRequestContexts. Since this is | 122 // This method can be reached from different URLRequestContexts. Since this is |
| 120 // a singleton, only log memory stats once. | 123 // a singleton, only log memory stats once. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 Flush(); | 199 Flush(); |
| 197 break; | 200 break; |
| 198 } | 201 } |
| 199 } | 202 } |
| 200 | 203 |
| 201 void SSLClientSessionCache::OnPurgeMemory() { | 204 void SSLClientSessionCache::OnPurgeMemory() { |
| 202 Flush(); | 205 Flush(); |
| 203 } | 206 } |
| 204 | 207 |
| 205 } // namespace net | 208 } // namespace net |
| OLD | NEW |