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

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

Issue 2699163002: Whitelist net/ MemoryDumpProvider (Closed)
Patch Set: fix test on windows Created 3 years, 10 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
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>
8
7 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
8 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
9 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
12 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/trace_event/memory_allocator_dump.h" 15 #include "base/trace_event/memory_allocator_dump.h"
14 #include "base/trace_event/memory_dump_manager.h" 16 #include "base/trace_event/memory_dump_manager.h"
17 #include "base/trace_event/memory_dump_request_args.h"
15 #include "base/trace_event/process_memory_dump.h" 18 #include "base/trace_event/process_memory_dump.h"
16 #include "net/base/sdch_manager.h" 19 #include "net/base/sdch_manager.h"
17 #include "net/cookies/cookie_store.h" 20 #include "net/cookies/cookie_store.h"
18 #include "net/dns/host_resolver.h" 21 #include "net/dns/host_resolver.h"
19 #include "net/http/http_cache.h" 22 #include "net/http/http_cache.h"
20 #include "net/http/http_transaction_factory.h" 23 #include "net/http/http_transaction_factory.h"
21 #include "net/socket/ssl_client_socket_impl.h" 24 #include "net/socket/ssl_client_socket_impl.h"
22 #include "net/url_request/http_user_agent_settings.h" 25 #include "net/url_request/http_user_agent_settings.h"
23 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
24 27
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: " 134 CHECK(false) << "Leaked " << num_requests << " URLRequest(s). First URL: "
132 << request->url().spec().c_str() << "."; 135 << request->url().spec().c_str() << ".";
133 } 136 }
134 } 137 }
135 138
136 bool URLRequestContext::OnMemoryDump( 139 bool URLRequestContext::OnMemoryDump(
137 const base::trace_event::MemoryDumpArgs& args, 140 const base::trace_event::MemoryDumpArgs& args,
138 base::trace_event::ProcessMemoryDump* pmd) { 141 base::trace_event::ProcessMemoryDump* pmd) {
139 if (name_.empty()) 142 if (name_.empty())
140 name_ = "unknown"; 143 name_ = "unknown";
141 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( 144
142 base::StringPrintf("net/url_request_context/%s_%p", name_.c_str(), this)); 145 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd);
146
147 std::string dump_name = base::StringPrintf(
148 "net/url_request_context_0x%" PRIxPTR, reinterpret_cast<uintptr_t>(this));
149 base::trace_event::MemoryAllocatorDump* dump =
150 pmd->CreateAllocatorDump(dump_name);
143 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, 151 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
144 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 152 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
145 url_requests_->size()); 153 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 }
146 HttpTransactionFactory* transaction_factory = http_transaction_factory(); 159 HttpTransactionFactory* transaction_factory = http_transaction_factory();
147 if (transaction_factory) { 160 if (transaction_factory) {
148 HttpNetworkSession* network_session = transaction_factory->GetSession(); 161 HttpNetworkSession* network_session = transaction_factory->GetSession();
149 if (network_session) 162 if (network_session)
150 network_session->DumpMemoryStats(pmd, dump->absolute_name()); 163 network_session->DumpMemoryStats(pmd, dump->absolute_name());
151 HttpCache* http_cache = transaction_factory->GetCache(); 164 HttpCache* http_cache = transaction_factory->GetCache();
152 if (http_cache) 165 if (http_cache)
153 http_cache->DumpMemoryStats(pmd, dump->absolute_name()); 166 http_cache->DumpMemoryStats(pmd, dump->absolute_name());
154 } 167 }
155 SSLClientSocketImpl::DumpSSLClientSessionMemoryStats(pmd);
156 if (sdch_manager_) 168 if (sdch_manager_)
157 sdch_manager_->DumpMemoryStats(pmd, dump->absolute_name()); 169 sdch_manager_->DumpMemoryStats(pmd, dump_name);
158 return true; 170 return true;
159 } 171 }
160 172
161 } // namespace net 173 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_client_session_cache_unittest.cc ('k') | net/url_request/url_request_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698