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

Unified Diff: net/http/http_network_session.cc

Issue 2525743002: Make URLRequestContext a MemoryDumpProvider (Abandoned) (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
Index: net/http/http_network_session.cc
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 2936e12e5048e5b176db85fc7768bf0e4b7b697c..716abfec2019f0a071d22cdfbe0fe3ed6932d77c 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"
@@ -381,6 +384,26 @@ void HttpNetworkSession::GetSSLConfig(const HttpRequestInfo& request,
}
}
+void HttpNetworkSession::DumpMemoryStats(
+ base::trace_event::MemoryAllocatorDump* url_request_context_dump) const {
+ std::string name = base::StringPrintf("net/http_network_session_%p", this);
+ base::trace_event::MemoryAllocatorDump* http_network_session_dump =
+ url_request_context_dump->process_memory_dump()->GetAllocatorDump(name);
+ // If |this| is shared with another URLRequestContext, add an Ownership Edge
+ // and return early.
+ if (http_network_session_dump != nullptr) {
+ url_request_context_dump->process_memory_dump()->AddOwnershipEdge(
+ url_request_context_dump->guid(), http_network_session_dump->guid());
+ return;
+ }
+ http_network_session_dump =
+ url_request_context_dump->process_memory_dump()->CreateAllocatorDump(
+ name);
+ url_request_context_dump->process_memory_dump()->AddOwnershipEdge(
+ url_request_context_dump->guid(), http_network_session_dump->guid());
+ normal_socket_pool_manager_->DumpMemoryStats(http_network_session_dump);
+}
ssid 2016/12/02 21:36:35 I feel it will look better if it's written as: if
+
ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
SocketPoolType pool_type) {
switch (pool_type) {

Powered by Google App Engine
This is Rietveld 408576698