Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/trace_event/memory_infra_background_whitelist.h" |
| 6 | |
| 7 | #include <ctype.h> |
| 8 | #include <string.h> |
| 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | #include "base/strings/string_util.h" |
Chad Duffin | ac9ac06 | 2019-07-23 10:06:45 -0700 | [diff] [blame] | 13 | #include "starboard/common/string.h" |
Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 14 | #include "starboard/types.h" |
| 15 | |
| 16 | namespace base { |
| 17 | namespace trace_event { |
| 18 | namespace { |
| 19 | |
| 20 | // The names of dump providers whitelisted for background tracing. Dump |
| 21 | // providers can be added here only if the background mode dump has very |
| 22 | // little processor and memory overhead. |
| 23 | // TODO(ssid): Some dump providers do not create ownership edges on background |
| 24 | // dump. So, the effective size will not be correct. |
| 25 | const char* const kDumpProviderWhitelist[] = { |
| 26 | "android::ResourceManagerImpl", |
| 27 | "AutocompleteController", |
| 28 | "BlinkGC", |
| 29 | "BlinkObjectCounters", |
| 30 | "BlobStorageContext", |
| 31 | "ClientDiscardableSharedMemoryManager", |
| 32 | "DOMStorage", |
| 33 | "DownloadService", |
| 34 | "DiscardableSharedMemoryManager", |
| 35 | "gpu::BufferManager", |
| 36 | "gpu::RenderbufferManager", |
| 37 | "gpu::TextureManager", |
| 38 | "FontCaches", |
| 39 | "HistoryReport", |
| 40 | "HistoryService", |
| 41 | "IPCChannel", |
| 42 | "IndexedDBBackingStore", |
| 43 | "InMemoryURLIndex", |
| 44 | "JavaHeap", |
| 45 | "LevelDB", |
| 46 | "LeveldbValueStore", |
| 47 | "LocalStorage", |
| 48 | "Malloc", |
| 49 | "MemoryCache", |
| 50 | "MojoHandleTable", |
| 51 | "MojoLevelDB", |
| 52 | "MojoMessages", |
| 53 | "PartitionAlloc", |
| 54 | "ProcessMemoryMetrics", |
| 55 | "RenderProcessHost", |
| 56 | "SharedMemoryTracker", |
| 57 | "Skia", |
| 58 | "Sql", |
| 59 | "URLRequestContext", |
| 60 | "V8Isolate", |
| 61 | "SyncDirectory", |
| 62 | "TabRestoreServiceHelper", |
| 63 | nullptr // End of list marker. |
| 64 | }; |
| 65 | |
| 66 | // A list of string names that are allowed for the memory allocator dumps in |
| 67 | // background mode. |
| 68 | const char* const kAllocatorDumpNameWhitelist[] = { |
| 69 | "blink_gc", |
| 70 | "blink_gc/allocated_objects", |
| 71 | "blink_objects/AdSubframe", |
| 72 | "blink_objects/AudioHandler", |
| 73 | "blink_objects/DetachedScriptState", |
| 74 | "blink_objects/Document", |
| 75 | "blink_objects/Frame", |
| 76 | "blink_objects/JSEventListener", |
| 77 | "blink_objects/LayoutObject", |
| 78 | "blink_objects/MediaKeySession", |
| 79 | "blink_objects/MediaKeys", |
| 80 | "blink_objects/Node", |
| 81 | "blink_objects/Resource", |
| 82 | "blink_objects/RTCPeerConnection", |
| 83 | "blink_objects/ScriptPromise", |
| 84 | "blink_objects/PausableObject", |
| 85 | "blink_objects/V8PerContextData", |
| 86 | "blink_objects/WorkerGlobalScope", |
| 87 | "blink_objects/UACSSResource", |
| 88 | "blink_objects/ResourceFetcher", |
| 89 | "components/download/controller_0x?", |
| 90 | "discardable", |
| 91 | "discardable/child_0x?", |
| 92 | "extensions/value_store/Extensions.Database.Open.Settings/0x?", |
| 93 | "extensions/value_store/Extensions.Database.Open.Rules/0x?", |
| 94 | "extensions/value_store/Extensions.Database.Open.State/0x?", |
| 95 | "extensions/value_store/Extensions.Database.Open/0x?", |
| 96 | "extensions/value_store/Extensions.Database.Restore/0x?", |
| 97 | "extensions/value_store/Extensions.Database.Value.Restore/0x?", |
| 98 | "font_caches/font_platform_data_cache", |
| 99 | "font_caches/shape_caches", |
| 100 | "gpu/gl/buffers/context_group_0x?", |
| 101 | "gpu/gl/renderbuffers/context_group_0x?", |
| 102 | "gpu/gl/textures/context_group_0x?", |
| 103 | "history/delta_file_service/leveldb_0x?", |
| 104 | "history/history_service", |
| 105 | "history/usage_reports_buffer/leveldb_0x?", |
| 106 | "java_heap", |
| 107 | "java_heap/allocated_objects", |
| 108 | "leveldatabase", |
| 109 | "leveldatabase/block_cache/browser", |
| 110 | "leveldatabase/block_cache/in_memory", |
| 111 | "leveldatabase/block_cache/unified", |
| 112 | "leveldatabase/block_cache/web", |
| 113 | "leveldatabase/db_0x?", |
| 114 | "leveldatabase/db_0x?/block_cache", |
| 115 | "leveldatabase/memenv_0x?", |
| 116 | "malloc", |
| 117 | "malloc/allocated_objects", |
| 118 | "malloc/metadata_fragmentation_caches", |
| 119 | "mojo", |
| 120 | "mojo/data_pipe_consumer", |
| 121 | "mojo/data_pipe_producer", |
| 122 | "mojo/invitation", |
| 123 | "mojo/messages", |
| 124 | "mojo/message_pipe", |
| 125 | "mojo/platform_handle", |
| 126 | "mojo/queued_ipc_channel_message/0x?", |
| 127 | "mojo/render_process_host/0x?", |
| 128 | "mojo/shared_buffer", |
| 129 | "mojo/unknown", |
| 130 | "mojo/watcher", |
| 131 | "net/http_network_session_0x?", |
| 132 | "net/http_network_session_0x?/quic_stream_factory", |
| 133 | "net/http_network_session_0x?/socket_pool", |
| 134 | "net/http_network_session_0x?/spdy_session_pool", |
| 135 | "net/http_network_session_0x?/stream_factory", |
| 136 | "net/ssl_session_cache", |
| 137 | "net/url_request_context", |
| 138 | "net/url_request_context/app_request", |
| 139 | "net/url_request_context/app_request/0x?", |
| 140 | "net/url_request_context/app_request/0x?/cookie_monster", |
| 141 | "net/url_request_context/app_request/0x?/cookie_monster/cookies", |
| 142 | "net/url_request_context/app_request/0x?/cookie_monster/" |
| 143 | "tasks_pending_global", |
| 144 | "net/url_request_context/app_request/0x?/cookie_monster/" |
| 145 | "tasks_pending_for_key", |
| 146 | "net/url_request_context/app_request/0x?/http_cache", |
| 147 | "net/url_request_context/app_request/0x?/http_cache/memory_backend", |
| 148 | "net/url_request_context/app_request/0x?/http_cache/simple_backend", |
| 149 | "net/url_request_context/app_request/0x?/http_network_session", |
| 150 | "net/url_request_context/extensions", |
| 151 | "net/url_request_context/extensions/0x?", |
| 152 | "net/url_request_context/extensions/0x?/cookie_monster", |
| 153 | "net/url_request_context/extensions/0x?/cookie_monster/cookies", |
| 154 | "net/url_request_context/extensions/0x?/cookie_monster/" |
| 155 | "tasks_pending_global", |
| 156 | "net/url_request_context/extensions/0x?/cookie_monster/" |
| 157 | "tasks_pending_for_key", |
| 158 | "net/url_request_context/extensions/0x?/http_cache", |
| 159 | "net/url_request_context/extensions/0x?/http_cache/memory_backend", |
| 160 | "net/url_request_context/extensions/0x?/http_cache/simple_backend", |
| 161 | "net/url_request_context/extensions/0x?/http_network_session", |
| 162 | "net/url_request_context/isolated_media", |
| 163 | "net/url_request_context/isolated_media/0x?", |
| 164 | "net/url_request_context/isolated_media/0x?/cookie_monster", |
| 165 | "net/url_request_context/isolated_media/0x?/cookie_monster/cookies", |
| 166 | "net/url_request_context/isolated_media/0x?/cookie_monster/" |
| 167 | "tasks_pending_global", |
| 168 | "net/url_request_context/isolated_media/0x?/cookie_monster/" |
| 169 | "tasks_pending_for_key", |
| 170 | "net/url_request_context/isolated_media/0x?/http_cache", |
| 171 | "net/url_request_context/isolated_media/0x?/http_cache/memory_backend", |
| 172 | "net/url_request_context/isolated_media/0x?/http_cache/simple_backend", |
| 173 | "net/url_request_context/isolated_media/0x?/http_network_session", |
| 174 | "net/url_request_context/main", |
| 175 | "net/url_request_context/main/0x?", |
| 176 | "net/url_request_context/main/0x?/cookie_monster", |
| 177 | "net/url_request_context/main/0x?/cookie_monster/cookies", |
| 178 | "net/url_request_context/main/0x?/cookie_monster/tasks_pending_global", |
| 179 | "net/url_request_context/main/0x?/cookie_monster/tasks_pending_for_key", |
| 180 | "net/url_request_context/main/0x?/http_cache", |
| 181 | "net/url_request_context/main/0x?/http_cache/memory_backend", |
| 182 | "net/url_request_context/main/0x?/http_cache/simple_backend", |
| 183 | "net/url_request_context/main/0x?/http_network_session", |
| 184 | "net/url_request_context/main_media", |
| 185 | "net/url_request_context/main_media/0x?", |
| 186 | "net/url_request_context/main_media/0x?/cookie_monster", |
| 187 | "net/url_request_context/main_media/0x?/cookie_monster/cookies", |
| 188 | "net/url_request_context/main_media/0x?/cookie_monster/" |
| 189 | "tasks_pending_global", |
| 190 | "net/url_request_context/main_media/0x?/cookie_monster/" |
| 191 | "tasks_pending_for_key", |
| 192 | "net/url_request_context/main_media/0x?/http_cache", |
| 193 | "net/url_request_context/main_media/0x?/http_cache/memory_backend", |
| 194 | "net/url_request_context/main_media/0x?/http_cache/simple_backend", |
| 195 | "net/url_request_context/main_media/0x?/http_network_session", |
| 196 | "net/url_request_context/mirroring", |
| 197 | "net/url_request_context/mirroring/0x?", |
| 198 | "net/url_request_context/mirroring/0x?/cookie_monster", |
| 199 | "net/url_request_context/mirroring/0x?/cookie_monster/cookies", |
| 200 | "net/url_request_context/mirroring/0x?/cookie_monster/tasks_pending_global", |
| 201 | "net/url_request_context/mirroring/0x?/cookie_monster/" |
| 202 | "tasks_pending_for_key", |
| 203 | "net/url_request_context/mirroring/0x?/http_cache", |
| 204 | "net/url_request_context/mirroring/0x?/http_cache/memory_backend", |
| 205 | "net/url_request_context/mirroring/0x?/http_cache/simple_backend", |
| 206 | "net/url_request_context/mirroring/0x?/http_network_session", |
| 207 | "net/url_request_context/proxy", |
| 208 | "net/url_request_context/proxy/0x?", |
| 209 | "net/url_request_context/proxy/0x?/cookie_monster", |
| 210 | "net/url_request_context/proxy/0x?/cookie_monster/cookies", |
| 211 | "net/url_request_context/proxy/0x?/cookie_monster/tasks_pending_global", |
| 212 | "net/url_request_context/proxy/0x?/cookie_monster/tasks_pending_for_key", |
| 213 | "net/url_request_context/proxy/0x?/http_cache", |
| 214 | "net/url_request_context/proxy/0x?/http_cache/memory_backend", |
| 215 | "net/url_request_context/proxy/0x?/http_cache/simple_backend", |
| 216 | "net/url_request_context/proxy/0x?/http_network_session", |
| 217 | "net/url_request_context/safe_browsing", |
| 218 | "net/url_request_context/safe_browsing/0x?", |
| 219 | "net/url_request_context/safe_browsing/0x?/cookie_monster", |
| 220 | "net/url_request_context/safe_browsing/0x?/cookie_monster/cookies", |
| 221 | "net/url_request_context/safe_browsing/0x?/cookie_monster/" |
| 222 | "tasks_pending_global", |
| 223 | "net/url_request_context/safe_browsing/0x?/cookie_monster/" |
| 224 | "tasks_pending_for_key", |
| 225 | "net/url_request_context/safe_browsing/0x?/http_cache", |
| 226 | "net/url_request_context/safe_browsing/0x?/http_cache/memory_backend", |
| 227 | "net/url_request_context/safe_browsing/0x?/http_cache/simple_backend", |
| 228 | "net/url_request_context/safe_browsing/0x?/http_network_session", |
| 229 | "net/url_request_context/system", |
| 230 | "net/url_request_context/system/0x?", |
| 231 | "net/url_request_context/system/0x?/cookie_monster", |
| 232 | "net/url_request_context/system/0x?/cookie_monster/cookies", |
| 233 | "net/url_request_context/system/0x?/cookie_monster/tasks_pending_global", |
| 234 | "net/url_request_context/system/0x?/cookie_monster/tasks_pending_for_key", |
| 235 | "net/url_request_context/system/0x?/http_cache", |
| 236 | "net/url_request_context/system/0x?/http_cache/memory_backend", |
| 237 | "net/url_request_context/system/0x?/http_cache/simple_backend", |
| 238 | "net/url_request_context/system/0x?/http_network_session", |
| 239 | "net/url_request_context/unknown", |
| 240 | "net/url_request_context/unknown/0x?", |
| 241 | "net/url_request_context/unknown/0x?/cookie_monster", |
| 242 | "net/url_request_context/unknown/0x?/cookie_monster/cookies", |
| 243 | "net/url_request_context/unknown/0x?/cookie_monster/tasks_pending_global", |
| 244 | "net/url_request_context/unknown/0x?/cookie_monster/tasks_pending_for_key", |
| 245 | "net/url_request_context/unknown/0x?/http_cache", |
| 246 | "net/url_request_context/unknown/0x?/http_cache/memory_backend", |
| 247 | "net/url_request_context/unknown/0x?/http_cache/simple_backend", |
| 248 | "net/url_request_context/unknown/0x?/http_network_session", |
| 249 | "omnibox/autocomplete_controller/0x?", |
| 250 | "omnibox/in_memory_url_index/0x?", |
| 251 | "web_cache/Image_resources", |
| 252 | "web_cache/CSS stylesheet_resources", |
| 253 | "web_cache/Script_resources", |
| 254 | "web_cache/XSL stylesheet_resources", |
| 255 | "web_cache/Font_resources", |
| 256 | "web_cache/Other_resources", |
| 257 | "partition_alloc/allocated_objects", |
| 258 | "partition_alloc/partitions", |
| 259 | "partition_alloc/partitions/array_buffer", |
| 260 | "partition_alloc/partitions/buffer", |
| 261 | "partition_alloc/partitions/fast_malloc", |
| 262 | "partition_alloc/partitions/layout", |
| 263 | "skia/sk_glyph_cache", |
| 264 | "skia/sk_resource_cache", |
| 265 | "sqlite", |
| 266 | "ui/resource_manager_0x?/default_resource/0x?", |
| 267 | "ui/resource_manager_0x?/tinted_resource", |
| 268 | "site_storage/blob_storage/0x?", |
| 269 | "v8/main/code_stats", |
| 270 | "v8/main/contexts/detached_context", |
| 271 | "v8/main/contexts/native_context", |
| 272 | "v8/main/heap/code_space", |
| 273 | "v8/main/heap/code_stats", |
| 274 | "v8/main/heap/large_object_space", |
| 275 | "v8/main/heap/map_space", |
| 276 | "v8/main/heap/new_large_object_space", |
| 277 | "v8/main/heap/new_space", |
| 278 | "v8/main/heap/old_space", |
| 279 | "v8/main/heap/read_only_space", |
| 280 | "v8/main/malloc", |
| 281 | "v8/main/zapped_for_debug", |
| 282 | "v8/utility/code_stats", |
| 283 | "v8/utility/contexts/detached_context", |
| 284 | "v8/utility/contexts/native_context", |
| 285 | "v8/utility/heap/code_space", |
| 286 | "v8/utility/heap/large_object_space", |
| 287 | "v8/utility/heap/map_space", |
| 288 | "v8/utility/heap/new_large_object_space", |
| 289 | "v8/utility/heap/new_space", |
| 290 | "v8/utility/heap/old_space", |
| 291 | "v8/utility/heap/read_only_space", |
| 292 | "v8/utility/malloc", |
| 293 | "v8/utility/zapped_for_debug", |
| 294 | "v8/workers/code_stats/isolate_0x?", |
| 295 | "v8/workers/contexts/detached_context/isolate_0x?", |
| 296 | "v8/workers/contexts/native_context/isolate_0x?", |
| 297 | "v8/workers/heap/code_space/isolate_0x?", |
| 298 | "v8/workers/heap/large_object_space/isolate_0x?", |
| 299 | "v8/workers/heap/map_space/isolate_0x?", |
| 300 | "v8/workers/heap/new_large_object_space/isolate_0x?", |
| 301 | "v8/workers/heap/new_space/isolate_0x?", |
| 302 | "v8/workers/heap/old_space/isolate_0x?", |
| 303 | "v8/workers/heap/read_only_space/isolate_0x?", |
| 304 | "v8/workers/malloc/isolate_0x?", |
| 305 | "v8/workers/zapped_for_debug/isolate_0x?", |
| 306 | "site_storage/index_db/db_0x?", |
| 307 | "site_storage/index_db/memenv_0x?", |
| 308 | "site_storage/localstorage/0x?/cache_size", |
| 309 | "site_storage/localstorage/0x?/leveldb", |
| 310 | "site_storage/session_storage/0x?", |
| 311 | "site_storage/session_storage/0x?/cache_size", |
| 312 | "sync/0x?/kernel", |
| 313 | "sync/0x?/store", |
| 314 | "sync/0x?/model_type/APP", |
| 315 | "sync/0x?/model_type/APP_LIST", |
| 316 | "sync/0x?/model_type/APP_NOTIFICATION", |
| 317 | "sync/0x?/model_type/APP_SETTING", |
| 318 | "sync/0x?/model_type/ARC_PACKAGE", |
| 319 | "sync/0x?/model_type/ARTICLE", |
| 320 | "sync/0x?/model_type/AUTOFILL", |
| 321 | "sync/0x?/model_type/AUTOFILL_PROFILE", |
| 322 | "sync/0x?/model_type/AUTOFILL_WALLET", |
| 323 | "sync/0x?/model_type/BOOKMARK", |
| 324 | "sync/0x?/model_type/DEVICE_INFO", |
| 325 | "sync/0x?/model_type/DICTIONARY", |
| 326 | "sync/0x?/model_type/EXPERIMENTS", |
| 327 | "sync/0x?/model_type/EXTENSION", |
| 328 | "sync/0x?/model_type/EXTENSION_SETTING", |
| 329 | "sync/0x?/model_type/FAVICON_IMAGE", |
| 330 | "sync/0x?/model_type/FAVICON_TRACKING", |
| 331 | "sync/0x?/model_type/HISTORY_DELETE_DIRECTIVE", |
| 332 | "sync/0x?/model_type/MANAGED_USER", |
| 333 | "sync/0x?/model_type/MANAGED_USER_SETTING", |
| 334 | "sync/0x?/model_type/MANAGED_USER_SHARED_SETTING", |
| 335 | "sync/0x?/model_type/MANAGED_USER_WHITELIST", |
| 336 | "sync/0x?/model_type/MOUNTAIN_SHARE", |
| 337 | "sync/0x?/model_type/NIGORI", |
| 338 | "sync/0x?/model_type/PASSWORD", |
| 339 | "sync/0x?/model_type/PREFERENCE", |
| 340 | "sync/0x?/model_type/PRINTER", |
| 341 | "sync/0x?/model_type/PRIORITY_PREFERENCE", |
| 342 | "sync/0x?/model_type/READING_LIST", |
| 343 | "sync/0x?/model_type/SEARCH_ENGINE", |
| 344 | "sync/0x?/model_type/SESSION", |
| 345 | "sync/0x?/model_type/SYNCED_NOTIFICATION", |
| 346 | "sync/0x?/model_type/SYNCED_NOTIFICATION_APP_INFO", |
| 347 | "sync/0x?/model_type/THEME", |
| 348 | "sync/0x?/model_type/TYPED_URL", |
| 349 | "sync/0x?/model_type/USER_CONSENT", |
| 350 | "sync/0x?/model_type/USER_EVENT", |
| 351 | "sync/0x?/model_type/WALLET_METADATA", |
| 352 | "sync/0x?/model_type/WIFI_CREDENTIAL", |
| 353 | "tab_restore/service_helper_0x?/entries", |
| 354 | "tab_restore/service_helper_0x?/entries/tab_0x?", |
| 355 | "tab_restore/service_helper_0x?/entries/window_0x?", |
| 356 | "tracing/heap_profiler_blink_gc/AllocationRegister", |
| 357 | "tracing/heap_profiler_malloc/AllocationRegister", |
| 358 | "tracing/heap_profiler_partition_alloc/AllocationRegister", |
| 359 | nullptr // End of list marker. |
| 360 | }; |
| 361 | |
| 362 | const char* const* g_dump_provider_whitelist = kDumpProviderWhitelist; |
| 363 | const char* const* g_allocator_dump_name_whitelist = |
| 364 | kAllocatorDumpNameWhitelist; |
| 365 | |
| 366 | bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) { |
| 367 | for (size_t i = 0; list[i] != nullptr; ++i) { |
| 368 | if (strcmp(mdp_name, list[i]) == 0) |
| 369 | return true; |
| 370 | } |
| 371 | return false; |
| 372 | } |
| 373 | |
| 374 | } // namespace |
| 375 | |
| 376 | bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) { |
| 377 | return IsMemoryDumpProviderInList(mdp_name, g_dump_provider_whitelist); |
| 378 | } |
| 379 | |
| 380 | bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) { |
| 381 | // Global dumps are explicitly whitelisted for background use. |
| 382 | if (base::StartsWith(name, "global/", CompareCase::SENSITIVE)) { |
Kaido Kert | 6f3fc44 | 2021-06-25 11:58:59 -0700 | [diff] [blame] | 383 | for (size_t i = strlen("global/"); i < name.size(); i++) |
Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 384 | if (!base::IsHexDigit(name[i])) |
| 385 | return false; |
| 386 | return true; |
| 387 | } |
| 388 | |
| 389 | if (base::StartsWith(name, "shared_memory/", CompareCase::SENSITIVE)) { |
Kaido Kert | 6f3fc44 | 2021-06-25 11:58:59 -0700 | [diff] [blame] | 390 | for (size_t i = strlen("shared_memory/"); i < name.size(); i++) |
Andrew Top | 0d1858f | 2019-05-15 22:01:47 -0700 | [diff] [blame] | 391 | if (!base::IsHexDigit(name[i])) |
| 392 | return false; |
| 393 | return true; |
| 394 | } |
| 395 | |
| 396 | // Remove special characters, numbers (including hexadecimal which are marked |
| 397 | // by '0x') from the given string. |
| 398 | const size_t length = name.size(); |
| 399 | std::string stripped_str; |
| 400 | stripped_str.reserve(length); |
| 401 | bool parsing_hex = false; |
| 402 | for (size_t i = 0; i < length; ++i) { |
| 403 | if (parsing_hex && isxdigit(name[i])) |
| 404 | continue; |
| 405 | parsing_hex = false; |
| 406 | if (i + 1 < length && name[i] == '0' && name[i + 1] == 'x') { |
| 407 | parsing_hex = true; |
| 408 | stripped_str.append("0x?"); |
| 409 | ++i; |
| 410 | } else { |
| 411 | stripped_str.push_back(name[i]); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | for (size_t i = 0; g_allocator_dump_name_whitelist[i] != nullptr; ++i) { |
| 416 | if (stripped_str == g_allocator_dump_name_whitelist[i]) { |
| 417 | return true; |
| 418 | } |
| 419 | } |
| 420 | return false; |
| 421 | } |
| 422 | |
| 423 | void SetDumpProviderWhitelistForTesting(const char* const* list) { |
| 424 | g_dump_provider_whitelist = list; |
| 425 | } |
| 426 | |
| 427 | void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) { |
| 428 | g_allocator_dump_name_whitelist = list; |
| 429 | } |
| 430 | |
| 431 | } // namespace trace_event |
| 432 | } // namespace base |