Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_context.h" | 5 #include "net/url_request/url_request_context.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " | 120 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " |
| 121 << request->url().spec().c_str() << "."; | 121 << request->url().spec().c_str() << "."; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool URLRequestContext::OnMemoryDump( | 125 bool URLRequestContext::OnMemoryDump( |
| 126 const base::trace_event::MemoryDumpArgs& args, | 126 const base::trace_event::MemoryDumpArgs& args, |
| 127 base::trace_event::ProcessMemoryDump* pmd) { | 127 base::trace_event::ProcessMemoryDump* pmd) { |
| 128 if (name_.empty()) | 128 if (name_.empty()) |
| 129 name_ = "unknown"; | 129 name_ = "unknown"; |
| 130 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( | 130 |
| 131 base::StringPrintf("net/url_request_context/%s_%p", name_.c_str(), this)); | 131 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd); |
| 132 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, | 132 |
| 133 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 133 // The details about the url request name is not added in BACKGROUND mode |
|
xunjieli
2017/02/02 22:33:27
nit: s/is/are
Think you meant to say "url request
ssid
2017/02/03 02:26:00
Done.
| |
| 134 url_requests_->size()); | 134 // dumps. |
| 135 std::string dump_name; | |
| 136 if (args.level_of_detail != | |
| 137 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { | |
| 138 dump_name = base::StringPrintf("net/url_request_context/%s_%p", | |
|
xunjieli
2017/02/02 22:33:27
I was about to instrument net::URLRequest and attr
ssid
2017/02/02 23:24:57
I see. I removed the url_requet_context dumps beca
xunjieli
2017/02/02 23:41:06
I see. I seriously wonder whether there is an end
| |
| 139 name_.c_str(), this); | |
| 140 base::trace_event::MemoryAllocatorDump* dump = | |
| 141 pmd->CreateAllocatorDump(dump_name); | |
| 142 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, | |
| 143 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | |
| 144 url_requests_->size()); | |
| 145 } | |
| 135 HttpTransactionFactory* transaction_factory = http_transaction_factory(); | 146 HttpTransactionFactory* transaction_factory = http_transaction_factory(); |
| 136 if (transaction_factory) { | 147 if (transaction_factory) { |
| 137 HttpNetworkSession* network_session = transaction_factory->GetSession(); | 148 HttpNetworkSession* network_session = transaction_factory->GetSession(); |
| 138 if (network_session) | 149 if (network_session) |
| 139 network_session->DumpMemoryStats(pmd, dump->absolute_name()); | 150 network_session->DumpMemoryStats(pmd, dump_name); |
| 140 } | 151 } |
| 141 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd); | |
| 142 if (sdch_manager_) | 152 if (sdch_manager_) |
| 143 sdch_manager_->DumpMemoryStats(pmd, dump->absolute_name()); | 153 sdch_manager_->DumpMemoryStats(pmd, dump_name); |
| 144 return true; | 154 return true; |
| 145 } | 155 } |
| 146 | 156 |
| 147 } // namespace net | 157 } // namespace net |
| OLD | NEW |