| Index: net/url_request/url_request_context.cc
|
| diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
|
| index 1e3dc4ead60cf6f6e5bfbeb349b0808af2e2db36..76626bfa60777729f1d2663c51c4ceb16e7ee44d 100644
|
| --- a/net/url_request/url_request_context.cc
|
| +++ b/net/url_request/url_request_context.cc
|
| @@ -14,6 +14,10 @@
|
| #include "net/url_request/http_user_agent_settings.h"
|
| #include "net/url_request/url_request.h"
|
|
|
| +#include "base/trace_event/memory_dump_manager.h"
|
| +#include "base/strings/stringprintf.h"
|
| +#include "net/socket/ssl_client_socket_impl.h"
|
| +
|
| namespace net {
|
|
|
| URLRequestContext::URLRequestContext()
|
| @@ -37,10 +41,15 @@ URLRequestContext::URLRequestContext()
|
| sdch_manager_(nullptr),
|
| network_quality_estimator_(nullptr),
|
| url_requests_(new std::set<const URLRequest*>),
|
| - enable_brotli_(false) {}
|
| + enable_brotli_(false) {
|
| + base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
|
| + this, "URLRequestContext", base::ThreadTaskRunnerHandle::Get());
|
| + }
|
|
|
| URLRequestContext::~URLRequestContext() {
|
| AssertNoURLRequests();
|
| + base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
|
| + this);
|
| }
|
|
|
| void URLRequestContext::CopyFrom(const URLRequestContext* other) {
|
| @@ -108,4 +117,26 @@ void URLRequestContext::AssertNoURLRequests() const {
|
| }
|
| }
|
|
|
| +bool URLRequestContext::OnMemoryDump(
|
| + const base::trace_event::MemoryDumpArgs& args,
|
| + base::trace_event::ProcessMemoryDump* pmd) {
|
| + if (name_string_.empty())
|
| + name_string_ = "uninitialized";
|
| + base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(
|
| + base::StringPrintf("net/url_request_context/%s_%p",
|
| + name_string_.c_str(), this));
|
| + for (auto url_request : *url_requests_.get()) {
|
| + url_request->PopulateAllocatorDump(dump);
|
| + }
|
| +
|
| + HttpTransactionFactory* transaction_factory = http_transaction_factory();
|
| + if (transaction_factory) {
|
| + HttpNetworkSession* network_session = transaction_factory->GetSession();
|
| + if (network_session)
|
| + network_session->PopulateAllocatorDump(dump);
|
| + }
|
| + SSLClientSocketImpl::PopulateSSLClientSessionAllocatorDump(dump);
|
| + return true;
|
| +}
|
| +
|
| } // namespace net
|
|
|