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

Side by Side Diff: base/trace_event/memory_infra_background_whitelist.cc

Issue 2772283003: Make url_request_context dumps include context names (Closed)
Patch Set: change filtering to avoid name clash 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 | « no previous file | chrome/browser/profiles/off_the_record_profile_io_data.h » ('j') | 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 "base/trace_event/memory_infra_background_whitelist.h" 5 #include "base/trace_event/memory_infra_background_whitelist.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 "malloc", 62 "malloc",
63 "malloc/allocated_objects", 63 "malloc/allocated_objects",
64 "malloc/metadata_fragmentation_caches", 64 "malloc/metadata_fragmentation_caches",
65 "net/http_network_session_0x?", 65 "net/http_network_session_0x?",
66 "net/http_network_session_0x?/quic_stream_factory", 66 "net/http_network_session_0x?/quic_stream_factory",
67 "net/http_network_session_0x?/socket_pool", 67 "net/http_network_session_0x?/socket_pool",
68 "net/http_network_session_0x?/spdy_session_pool", 68 "net/http_network_session_0x?/spdy_session_pool",
69 "net/http_network_session_0x?/stream_factory", 69 "net/http_network_session_0x?/stream_factory",
70 "net/sdch_manager_0x?", 70 "net/sdch_manager_0x?",
71 "net/ssl_session_cache", 71 "net/ssl_session_cache",
72 "net/url_request_context_0x?", 72 "net/url_request_context",
73 "net/url_request_context_0x?/http_cache", 73 "net/url_request_context/%s",
74 "net/url_request_context_0x?/http_network_session", 74 "net/url_request_context/%s/0x?",
75 "net/url_request_context_0x?/sdch_manager", 75 "net/url_request_context/%s/0x?/http_cache",
76 "net/url_request_context/%s/0x?/http_network_session",
77 "net/url_request_context/%s/0x?/sdch_manager",
76 "web_cache/Image_resources", 78 "web_cache/Image_resources",
77 "web_cache/CSS stylesheet_resources", 79 "web_cache/CSS stylesheet_resources",
78 "web_cache/Script_resources", 80 "web_cache/Script_resources",
79 "web_cache/XSL stylesheet_resources", 81 "web_cache/XSL stylesheet_resources",
80 "web_cache/Font_resources", 82 "web_cache/Font_resources",
81 "web_cache/Other_resources", 83 "web_cache/Other_resources",
82 "partition_alloc/allocated_objects", 84 "partition_alloc/allocated_objects",
83 "partition_alloc/partitions", 85 "partition_alloc/partitions",
84 "partition_alloc/partitions/array_buffer", 86 "partition_alloc/partitions/array_buffer",
85 "partition_alloc/partitions/buffer", 87 "partition_alloc/partitions/buffer",
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 parsing_hex = false; 173 parsing_hex = false;
172 if (i + 1 < length && name[i] == '0' && name[i + 1] == 'x') { 174 if (i + 1 < length && name[i] == '0' && name[i + 1] == 'x') {
173 parsing_hex = true; 175 parsing_hex = true;
174 stripped_str.append("0x?"); 176 stripped_str.append("0x?");
175 ++i; 177 ++i;
176 } else { 178 } else {
177 stripped_str.push_back(name[i]); 179 stripped_str.push_back(name[i]);
178 } 180 }
179 } 181 }
180 182
183 std::string url_request_context_prefix = "url_request_context/";
184 size_t pos = stripped_str.find(url_request_context_prefix);
185 if (pos != std::string::npos) {
186 size_t replace_start = pos + url_request_context_prefix.length();
187 size_t replace_end = stripped_str.find('\\', replace_start);
188 if (replace_end == std::string::npos)
189 replace_end = stripped_str.length();
190 stripped_str.replace(replace_start, replace_end - pos, "%s");
ssid 2017/03/27 23:02:34 No this is exactly what we are trying to avoid in
xunjieli 2017/03/28 01:04:56 Done. Just to clarify: URLRequestContext is the
191 }
192
181 for (size_t i = 0; g_allocator_dump_name_whitelist[i] != nullptr; ++i) { 193 for (size_t i = 0; g_allocator_dump_name_whitelist[i] != nullptr; ++i) {
182 if (stripped_str == g_allocator_dump_name_whitelist[i]) { 194 if (stripped_str == g_allocator_dump_name_whitelist[i]) {
183 return true; 195 return true;
184 } 196 }
185 } 197 }
186 return false; 198 return false;
187 } 199 }
188 200
189 void SetDumpProviderWhitelistForTesting(const char* const* list) { 201 void SetDumpProviderWhitelistForTesting(const char* const* list) {
190 g_dump_provider_whitelist = list; 202 g_dump_provider_whitelist = list;
191 } 203 }
192 204
193 void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) { 205 void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) {
194 g_allocator_dump_name_whitelist = list; 206 g_allocator_dump_name_whitelist = list;
195 } 207 }
196 208
197 } // namespace trace_event 209 } // namespace trace_event
198 } // namespace base 210 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/off_the_record_profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698