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 context name are not added in BACKGROUND |
134 url_requests_->size()); | 134 // mode 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", | |
Primiano Tucci (use gerrit)
2017/02/03 03:18:50
don't you have to do this outside of the if?
other
ssid
2017/02/03 03:27:56
I am intentionally passing empty dump name here so
| |
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); | |
Primiano Tucci (use gerrit)
2017/02/03 03:18:50
just checking, is this removal intended or just ac
ssid
2017/02/03 03:27:56
I moved it up since it is a static function call.
| |
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 |