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

Unified Diff: net/http/http_network_session.cc

Issue 2541093003: Instrument SSL sockets using MemoryDumpProvider (Closed)
Patch Set: rebased 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
Index: net/http/http_network_session.cc
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index cbe28807c501264b4112e13a86b7a87155f5ce9f..3099291ca9e6e9bccddc665d8553fa830aaae708 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -15,6 +15,9 @@
#include "base/profiler/scoped_tracker.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/process_memory_dump.h"
#include "base/values.h"
#include "net/base/network_throttle_manager_impl.h"
#include "net/http/http_auth_handler_factory.h"
@@ -377,6 +380,29 @@ void HttpNetworkSession::GetSSLConfig(const HttpRequestInfo& request,
}
}
+void HttpNetworkSession::DumpMemoryStats(
+ base::trace_event::ProcessMemoryDump* pmd,
+ const std::string& parent_absolute_name) const {
+ 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(),
Primiano Tucci (use gerrit) 2016/12/06 17:06:28 Hmm I think this is not going to make anything use
xunjieli 2016/12/06 18:36:08 No, it won't ever create two edges between the sam
Primiano Tucci (use gerrit) 2016/12/06 20:15:41 We had an offline chat on this. I dumped my brain
xunjieli 2016/12/06 21:22:11 Thanks for the follow-up! I tried your suggestion
+ http_network_session_dump->guid());
+
+ return;
+ }
+ http_network_session_dump = pmd->CreateAllocatorDump(name);
+ normal_socket_pool_manager_->DumpMemoryStats(
+ pmd, http_network_session_dump->absolute_name());
+ pmd->AddOwnershipEdge(pmd->GetAllocatorDump(parent_absolute_name)->guid(),
+ http_network_session_dump->guid());
+}
+
ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
SocketPoolType pool_type) {
switch (pool_type) {

Powered by Google App Engine
This is Rietveld 408576698