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

Side by Side Diff: net/url_request/url_request_context.cc

Issue 2772283003: Make url_request_context dumps include context names (Closed)
Patch Set: Revert back to an explicit list Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 cert_transparency_verifier_(nullptr), 42 cert_transparency_verifier_(nullptr),
43 ct_policy_enforcer_(nullptr), 43 ct_policy_enforcer_(nullptr),
44 http_transaction_factory_(nullptr), 44 http_transaction_factory_(nullptr),
45 job_factory_(nullptr), 45 job_factory_(nullptr),
46 throttler_manager_(nullptr), 46 throttler_manager_(nullptr),
47 backoff_manager_(nullptr), 47 backoff_manager_(nullptr),
48 sdch_manager_(nullptr), 48 sdch_manager_(nullptr),
49 network_quality_estimator_(nullptr), 49 network_quality_estimator_(nullptr),
50 url_requests_(new std::set<const URLRequest*>), 50 url_requests_(new std::set<const URLRequest*>),
51 enable_brotli_(false), 51 enable_brotli_(false),
52 check_cleartext_permitted_(false) { 52 check_cleartext_permitted_(false),
53 name_(nullptr) {
53 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 54 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
54 this, "URLRequestContext", base::ThreadTaskRunnerHandle::Get()); 55 this, "URLRequestContext", base::ThreadTaskRunnerHandle::Get());
55 } 56 }
56 57
57 URLRequestContext::~URLRequestContext() { 58 URLRequestContext::~URLRequestContext() {
58 AssertNoURLRequests(); 59 AssertNoURLRequests();
59 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 60 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
60 this); 61 this);
61 } 62 }
62 63
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::debug::Alias(&num_requests); 133 base::debug::Alias(&num_requests);
133 base::debug::Alias(&load_flags); 134 base::debug::Alias(&load_flags);
134 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " 135 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: "
135 << request->url().spec().c_str() << "."; 136 << request->url().spec().c_str() << ".";
136 } 137 }
137 } 138 }
138 139
139 bool URLRequestContext::OnMemoryDump( 140 bool URLRequestContext::OnMemoryDump(
140 const base::trace_event::MemoryDumpArgs& args, 141 const base::trace_event::MemoryDumpArgs& args,
141 base::trace_event::ProcessMemoryDump* pmd) { 142 base::trace_event::ProcessMemoryDump* pmd) {
142 if (name_.empty()) 143 if (!name_)
143 name_ = "unknown"; 144 name_ = "unknown";
144 145
145 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd); 146 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd);
146 147
147 std::string dump_name = base::StringPrintf( 148 std::string dump_name =
148 "net/url_request_context_0x%" PRIxPTR, reinterpret_cast<uintptr_t>(this)); 149 base::StringPrintf("net/url_request_context/%s/0x%" PRIxPTR, name_,
150 reinterpret_cast<uintptr_t>(this));
149 base::trace_event::MemoryAllocatorDump* dump = 151 base::trace_event::MemoryAllocatorDump* dump =
150 pmd->CreateAllocatorDump(dump_name); 152 pmd->CreateAllocatorDump(dump_name);
151 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, 153 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
152 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 154 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
153 url_requests_->size()); 155 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(); 156 HttpTransactionFactory* transaction_factory = http_transaction_factory();
160 if (transaction_factory) { 157 if (transaction_factory) {
161 HttpNetworkSession* network_session = transaction_factory->GetSession(); 158 HttpNetworkSession* network_session = transaction_factory->GetSession();
162 if (network_session) 159 if (network_session)
163 network_session->DumpMemoryStats(pmd, dump->absolute_name()); 160 network_session->DumpMemoryStats(pmd, dump->absolute_name());
164 HttpCache* http_cache = transaction_factory->GetCache(); 161 HttpCache* http_cache = transaction_factory->GetCache();
165 if (http_cache) 162 if (http_cache)
166 http_cache->DumpMemoryStats(pmd, dump->absolute_name()); 163 http_cache->DumpMemoryStats(pmd, dump->absolute_name());
167 } 164 }
168 if (sdch_manager_) 165 if (sdch_manager_)
169 sdch_manager_->DumpMemoryStats(pmd, dump_name); 166 sdch_manager_->DumpMemoryStats(pmd, dump_name);
170 return true; 167 return true;
171 } 168 }
172 169
173 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698