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

Unified Diff: net/socket/ssl_client_socket_impl.cc

Issue 2696403007: Add a multiplier in tracking certificate memory allocation size (Closed)
Patch Set: self Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_impl.cc
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc
index bdc9dbad00afb04ab598b4631658e59807896c44..69c4a21da6db7d272b1d6d0a0a5b7c516cad5f76 100644
--- a/net/socket/ssl_client_socket_impl.cc
+++ b/net/socket/ssl_client_socket_impl.cc
@@ -845,14 +845,15 @@ void SSLClientSocketImpl::DumpMemoryStats(SocketMemoryStats* stats) const {
if (server_cert_chain_) {
for (size_t i = 0; i < server_cert_chain_->size(); ++i) {
X509* cert = server_cert_chain_->Get(i);
- // This measures the lower bound of the serialized certificate. It doesn't
- // measure the actual memory used, which is 4x this amount (see
- // crbug.com/671420 for more details).
- stats->serialized_cert_size += i2d_X509(cert, nullptr);
+ // Estimate the size of the certificate before deduplication.
+ // The multiplier (4) is added to account for the difference between the
+ // serialized cert size and the actual cert allocation.
+ // TODO(xunjieli): Update this after crbug.com/671420 is done.
+ stats->cert_size += 4 * i2d_X509(cert, nullptr);
}
stats->cert_count = server_cert_chain_->size();
}
- stats->total_size = stats->buffer_size + stats->serialized_cert_size;
+ stats->total_size = stats->buffer_size + stats->cert_size;
}
// static
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | net/socket/ssl_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698