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

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

Issue 2560593002: Make HttpNetworkSession::DumpMemoryStats attribute memory usage correctly (Closed)
Patch Set: self review Created 4 years 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/http/http_network_session.cc ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 7 #include <memory>
8 8
9 #include "base/trace_event/process_memory_dump.h" 9 #include "base/trace_event/process_memory_dump.h"
10 #include "net/proxy/proxy_config_service_fixed.h" 10 #include "net/proxy/proxy_config_service_fixed.h"
(...skipping 14 matching lines...) Expand all
25 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect())); 25 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect()));
26 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 26 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
27 std::unique_ptr<URLRequestContext> context(builder.Build()); 27 std::unique_ptr<URLRequestContext> context(builder.Build());
28 context->OnMemoryDump(dump_args, process_memory_dump.get()); 28 context->OnMemoryDump(dump_args, process_memory_dump.get());
29 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& 29 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap&
30 allocator_dumps = process_memory_dump->allocator_dumps(); 30 allocator_dumps = process_memory_dump->allocator_dumps();
31 31
32 bool did_dump_http_network_session = false; 32 bool did_dump_http_network_session = false;
33 bool did_dump_ssl_client_session_cache = false; 33 bool did_dump_ssl_client_session_cache = false;
34 bool did_dump_url_request_context = false; 34 bool did_dump_url_request_context = false;
35 bool did_dump_url_request_context_http_network_session = false;
35 for (const auto& it : allocator_dumps) { 36 for (const auto& it : allocator_dumps) {
36 const std::string& dump_name = it.first; 37 const std::string& dump_name = it.first;
37 if (dump_name.find("net/http_network_session") != std::string::npos) 38 if (dump_name.find("net/http_network_session") != std::string::npos)
38 did_dump_http_network_session = true; 39 did_dump_http_network_session = true;
39 if (dump_name.find("net/ssl_session_cache") != std::string::npos) 40 if (dump_name.find("net/ssl_session_cache") != std::string::npos)
40 did_dump_ssl_client_session_cache = true; 41 did_dump_ssl_client_session_cache = true;
41 if (dump_name.find("net/url_request_context") != std::string::npos) 42 if (dump_name.find("net/url_request_context") != std::string::npos) {
42 did_dump_url_request_context = true; 43 // A sub allocator dump to take into account of the sharing relationship.
44 if (dump_name.find("http_network_session") != std::string::npos) {
45 did_dump_url_request_context_http_network_session = true;
46 } else {
47 did_dump_url_request_context = true;
48 }
49 }
43 } 50 }
44 ASSERT_TRUE(did_dump_http_network_session); 51 ASSERT_TRUE(did_dump_http_network_session);
45 ASSERT_TRUE(did_dump_ssl_client_session_cache); 52 ASSERT_TRUE(did_dump_ssl_client_session_cache);
46 ASSERT_TRUE(did_dump_url_request_context); 53 ASSERT_TRUE(did_dump_url_request_context);
54 ASSERT_TRUE(did_dump_url_request_context_http_network_session);
47 } 55 }
48 56
49 // TODO(xunjieli): Add more granular tests on the MemoryDumpProvider. 57 // TODO(xunjieli): Add more granular tests on the MemoryDumpProvider.
50 } // namespace net 58 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698