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 <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 } | 137 } |
138 | 138 |
139 bool URLRequestContext::OnMemoryDump( | 139 bool URLRequestContext::OnMemoryDump( |
140 const base::trace_event::MemoryDumpArgs& args, | 140 const base::trace_event::MemoryDumpArgs& args, |
141 base::trace_event::ProcessMemoryDump* pmd) { | 141 base::trace_event::ProcessMemoryDump* pmd) { |
142 if (name_.empty()) | 142 if (name_.empty()) |
143 name_ = "unknown"; | 143 name_ = "unknown"; |
144 | 144 |
145 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd); | 145 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd); |
146 | 146 |
147 std::string dump_name = base::StringPrintf( | 147 std::string dump_name = |
148 "net/url_request_context_0x%" PRIxPTR, reinterpret_cast<uintptr_t>(this)); | 148 base::StringPrintf("net/url_request_context/%s/0x%" PRIxPTR, |
149 name_.c_str(), reinterpret_cast<uintptr_t>(this)); | |
ssid
2017/03/27 18:43:15
Are we sure that we know all the possible names he
xunjieli
2017/03/27 19:24:55
Done.
| |
149 base::trace_event::MemoryAllocatorDump* dump = | 150 base::trace_event::MemoryAllocatorDump* dump = |
150 pmd->CreateAllocatorDump(dump_name); | 151 pmd->CreateAllocatorDump(dump_name); |
151 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, | 152 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
152 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 153 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
153 url_requests_->size()); | 154 url_requests_->size()); |
154 if (args.level_of_detail != | |
155 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { | |
156 dump->AddString("origin", | |
157 base::trace_event::MemoryAllocatorDump::kTypeString, name_); | |
158 } | |
159 HttpTransactionFactory* transaction_factory = http_transaction_factory(); | 155 HttpTransactionFactory* transaction_factory = http_transaction_factory(); |
160 if (transaction_factory) { | 156 if (transaction_factory) { |
161 HttpNetworkSession* network_session = transaction_factory->GetSession(); | 157 HttpNetworkSession* network_session = transaction_factory->GetSession(); |
162 if (network_session) | 158 if (network_session) |
163 network_session->DumpMemoryStats(pmd, dump->absolute_name()); | 159 network_session->DumpMemoryStats(pmd, dump->absolute_name()); |
164 HttpCache* http_cache = transaction_factory->GetCache(); | 160 HttpCache* http_cache = transaction_factory->GetCache(); |
165 if (http_cache) | 161 if (http_cache) |
166 http_cache->DumpMemoryStats(pmd, dump->absolute_name()); | 162 http_cache->DumpMemoryStats(pmd, dump->absolute_name()); |
167 } | 163 } |
168 if (sdch_manager_) | 164 if (sdch_manager_) |
169 sdch_manager_->DumpMemoryStats(pmd, dump_name); | 165 sdch_manager_->DumpMemoryStats(pmd, dump_name); |
170 return true; | 166 return true; |
171 } | 167 } |
172 | 168 |
173 } // namespace net | 169 } // namespace net |
OLD | NEW |