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

Unified Diff: net/http/http_network_session.cc

Issue 2560593002: Make HttpNetworkSession::DumpMemoryStats attribute memory usage correctly (Closed)
Patch Set: self review 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/url_request/url_request_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_session.cc
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 7d6fc01cf3b268f2c05333124e51909ffab69e31..58da933445e030e94aa3f3553eb87d9cfc04f506 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -386,22 +386,19 @@ void HttpNetworkSession::DumpMemoryStats(
std::string name = base::StringPrintf("net/http_network_session_%p", this);
base::trace_event::MemoryAllocatorDump* http_network_session_dump =
pmd->GetAllocatorDump(name);
- // If memory dump already exists, it means that this is not the first
- // DumpMemoryStats() invocation on this object and it is reached by another
- // "parent." If that's the case, add an ownership edge and return early.
- // This is needed because URLRequestContexts can share an HttpNetworkSession.
- if (http_network_session_dump != nullptr) {
- pmd->AddOwnershipEdge(pmd->GetAllocatorDump(parent_absolute_name)->guid(),
- http_network_session_dump->guid());
-
- return;
+ if (http_network_session_dump == nullptr) {
+ http_network_session_dump = pmd->CreateAllocatorDump(name);
+ normal_socket_pool_manager_->DumpMemoryStats(
+ pmd, http_network_session_dump->absolute_name());
+ spdy_session_pool_.DumpMemoryStats(
+ pmd, http_network_session_dump->absolute_name());
}
- http_network_session_dump = pmd->CreateAllocatorDump(name);
- normal_socket_pool_manager_->DumpMemoryStats(
- pmd, http_network_session_dump->absolute_name());
- spdy_session_pool_.DumpMemoryStats(
- pmd, http_network_session_dump->absolute_name());
- pmd->AddOwnershipEdge(pmd->GetAllocatorDump(parent_absolute_name)->guid(),
+ // Create an empty row under parent's dump so size can be attributed correctly
+ // if |this| is shared between URLRequestContexts.
+ base::trace_event::MemoryAllocatorDump* empty_row_dump =
+ pmd->CreateAllocatorDump(base::StringPrintf(
+ "%s/http_network_session", parent_absolute_name.c_str()));
+ pmd->AddOwnershipEdge(empty_row_dump->guid(),
http_network_session_dump->guid());
}
« no previous file with comments | « no previous file | net/url_request/url_request_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698