OLD | NEW |
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 Loading... |
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 |
OLD | NEW |