Commit 6dc9eb71 authored by Eugene Zemtsov's avatar Eugene Zemtsov Committed by Commit Bot

Rename memory_infra_background_whitelist to allowlist

Also renaming related functions and variables.
Making wording more inclusive.

Bug: 842296
Change-Id: If1121d2496c151a87ecb9a517633195d8e851a7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095841Reviewed-by: default avatarPrimiano Tucci <primiano@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Eugene Zemtsov <eugene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749314}
parent 51371b2f
...@@ -811,8 +811,8 @@ jumbo_component("base") { ...@@ -811,8 +811,8 @@ jumbo_component("base") {
"trace_event/memory_dump_request_args.h", "trace_event/memory_dump_request_args.h",
"trace_event/memory_dump_scheduler.cc", "trace_event/memory_dump_scheduler.cc",
"trace_event/memory_dump_scheduler.h", "trace_event/memory_dump_scheduler.h",
"trace_event/memory_infra_background_whitelist.cc", "trace_event/memory_infra_background_allowlist.cc",
"trace_event/memory_infra_background_whitelist.h", "trace_event/memory_infra_background_allowlist.h",
"trace_event/memory_usage_estimator.cc", "trace_event/memory_usage_estimator.cc",
"trace_event/memory_usage_estimator.h", "trace_event/memory_usage_estimator.h",
"trace_event/process_memory_dump.cc", "trace_event/process_memory_dump.cc",
...@@ -2756,7 +2756,7 @@ test("base_unittests") { ...@@ -2756,7 +2756,7 @@ test("base_unittests") {
"trace_event/memory_allocator_dump_unittest.cc", "trace_event/memory_allocator_dump_unittest.cc",
"trace_event/memory_dump_manager_unittest.cc", "trace_event/memory_dump_manager_unittest.cc",
"trace_event/memory_dump_scheduler_unittest.cc", "trace_event/memory_dump_scheduler_unittest.cc",
"trace_event/memory_infra_background_whitelist_unittest.cc", "trace_event/memory_infra_background_allowlist_unittest.cc",
"trace_event/memory_usage_estimator_unittest.cc", "trace_event/memory_usage_estimator_unittest.cc",
"trace_event/process_memory_dump_unittest.cc", "trace_event/process_memory_dump_unittest.cc",
"trace_event/trace_arguments_unittest.cc", "trace_event/trace_arguments_unittest.cc",
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "base/trace_event/malloc_dump_provider.h" #include "base/trace_event/malloc_dump_provider.h"
#include "base/trace_event/memory_dump_provider.h" #include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_scheduler.h" #include "base/trace_event/memory_dump_scheduler.h"
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/process_memory_dump.h" #include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
...@@ -180,14 +180,13 @@ void MemoryDumpManager::RegisterDumpProviderInternal( ...@@ -180,14 +180,13 @@ void MemoryDumpManager::RegisterDumpProviderInternal(
return; return;
// Only a handful of MDPs are required to compute the memory metrics. These // Only a handful of MDPs are required to compute the memory metrics. These
// have small enough performance overhead that it is resonable to run them // have small enough performance overhead that it is reasonable to run them
// in the background while the user is doing other things. Those MDPs are // in the background while the user is doing other things. Those MDPs are
// 'whitelisted for background mode'. // 'allowed in background mode'.
bool whitelisted_for_background_mode = IsMemoryDumpProviderWhitelisted(name); bool allowed_in_background_mode = IsMemoryDumpProviderInAllowlist(name);
scoped_refptr<MemoryDumpProviderInfo> mdpinfo = scoped_refptr<MemoryDumpProviderInfo> mdpinfo = new MemoryDumpProviderInfo(
new MemoryDumpProviderInfo(mdp, name, std::move(task_runner), options, mdp, name, std::move(task_runner), options, allowed_in_background_mode);
whitelisted_for_background_mode);
{ {
AutoLock lock(lock_); AutoLock lock(lock_);
...@@ -348,7 +347,7 @@ void MemoryDumpManager::ContinueAsyncProcessDump( ...@@ -348,7 +347,7 @@ void MemoryDumpManager::ContinueAsyncProcessDump(
// providers. Ignore other providers and continue. // providers. Ignore other providers and continue.
if (pmd_async_state->req_args.level_of_detail == if (pmd_async_state->req_args.level_of_detail ==
MemoryDumpLevelOfDetail::BACKGROUND && MemoryDumpLevelOfDetail::BACKGROUND &&
!mdpinfo->whitelisted_for_background_mode) { !mdpinfo->allowed_in_background_mode) {
pmd_async_state->pending_dump_providers.pop_back(); pmd_async_state->pending_dump_providers.pop_back();
continue; continue;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "base/trace_event/memory_dump_provider.h" #include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_request_args.h" #include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/memory_dump_scheduler.h" #include "base/trace_event/memory_dump_scheduler.h"
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/process_memory_dump.h" #include "base/trace_event/process_memory_dump.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
...@@ -752,7 +752,7 @@ TEST_F(MemoryDumpManagerTest, TriggerDumpWithoutTracing) { ...@@ -752,7 +752,7 @@ TEST_F(MemoryDumpManagerTest, TriggerDumpWithoutTracing) {
} }
TEST_F(MemoryDumpManagerTest, BackgroundWhitelisting) { TEST_F(MemoryDumpManagerTest, BackgroundWhitelisting) {
SetDumpProviderWhitelistForTesting(kTestMDPWhitelist); SetDumpProviderAllowlistForTesting(kTestMDPWhitelist);
// Standard provider with default options (create dump for current process). // Standard provider with default options (create dump for current process).
MockMemoryDumpProvider backgroundMdp; MockMemoryDumpProvider backgroundMdp;
...@@ -857,7 +857,7 @@ class SimpleMockMemoryDumpProvider : public MemoryDumpProvider { ...@@ -857,7 +857,7 @@ class SimpleMockMemoryDumpProvider : public MemoryDumpProvider {
}; };
TEST_F(MemoryDumpManagerTest, NoStackOverflowWithTooManyMDPs) { TEST_F(MemoryDumpManagerTest, NoStackOverflowWithTooManyMDPs) {
SetDumpProviderWhitelistForTesting(kTestMDPWhitelist); SetDumpProviderAllowlistForTesting(kTestMDPWhitelist);
int kMDPCount = 1000; int kMDPCount = 1000;
std::vector<std::unique_ptr<SimpleMockMemoryDumpProvider>> mdps; std::vector<std::unique_ptr<SimpleMockMemoryDumpProvider>> mdps;
......
...@@ -16,12 +16,12 @@ MemoryDumpProviderInfo::MemoryDumpProviderInfo( ...@@ -16,12 +16,12 @@ MemoryDumpProviderInfo::MemoryDumpProviderInfo(
const char* name, const char* name,
scoped_refptr<SequencedTaskRunner> task_runner, scoped_refptr<SequencedTaskRunner> task_runner,
const MemoryDumpProvider::Options& options, const MemoryDumpProvider::Options& options,
bool whitelisted_for_background_mode) bool allowed_in_background_mode)
: dump_provider(dump_provider), : dump_provider(dump_provider),
options(options), options(options),
name(name), name(name),
task_runner(std::move(task_runner)), task_runner(std::move(task_runner)),
whitelisted_for_background_mode(whitelisted_for_background_mode), allowed_in_background_mode(allowed_in_background_mode),
consecutive_failures(0), consecutive_failures(0),
disabled(false) {} disabled(false) {}
......
...@@ -58,7 +58,7 @@ struct BASE_EXPORT MemoryDumpProviderInfo ...@@ -58,7 +58,7 @@ struct BASE_EXPORT MemoryDumpProviderInfo
const char* name, const char* name,
scoped_refptr<SequencedTaskRunner> task_runner, scoped_refptr<SequencedTaskRunner> task_runner,
const MemoryDumpProvider::Options& options, const MemoryDumpProvider::Options& options,
bool whitelisted_for_background_mode); bool allowed_in_background_mode);
// It is safe to access the const fields below from any thread as they are // It is safe to access the const fields below from any thread as they are
// never mutated. // never mutated.
...@@ -78,7 +78,7 @@ struct BASE_EXPORT MemoryDumpProviderInfo ...@@ -78,7 +78,7 @@ struct BASE_EXPORT MemoryDumpProviderInfo
const scoped_refptr<SequencedTaskRunner> task_runner; const scoped_refptr<SequencedTaskRunner> task_runner;
// True if the dump provider is whitelisted for background mode. // True if the dump provider is whitelisted for background mode.
const bool whitelisted_for_background_mode; const bool allowed_in_background_mode;
// These fields below, instead, are not thread safe and can be mutated only: // These fields below, instead, are not thread safe and can be mutated only:
// - On the |task_runner|, when not null (i.e. for thread-bound MDPS). // - On the |task_runner|, when not null (i.e. for thread-bound MDPS).
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
...@@ -15,12 +15,12 @@ namespace base { ...@@ -15,12 +15,12 @@ namespace base {
namespace trace_event { namespace trace_event {
namespace { namespace {
// The names of dump providers whitelisted for background tracing. Dump // The names of dump providers allowed to perform background tracing. Dump
// providers can be added here only if the background mode dump has very // providers can be added here only if the background mode dump has very
// little processor and memory overhead. // little processor and memory overhead.
// TODO(ssid): Some dump providers do not create ownership edges on background // TODO(ssid): Some dump providers do not create ownership edges on background
// dump. So, the effective size will not be correct. // dump. So, the effective size will not be correct.
const char* const kDumpProviderWhitelist[] = { const char* const kDumpProviderAllowlist[] = {
"android::ResourceManagerImpl", "android::ResourceManagerImpl",
"AutocompleteController", "AutocompleteController",
"BlinkGC", "BlinkGC",
...@@ -70,7 +70,7 @@ const char* const kDumpProviderWhitelist[] = { ...@@ -70,7 +70,7 @@ const char* const kDumpProviderWhitelist[] = {
// A list of string names that are allowed for the memory allocator dumps in // A list of string names that are allowed for the memory allocator dumps in
// background mode. // background mode.
const char* const kAllocatorDumpNameWhitelist[] = { const char* const kAllocatorDumpNameAllowlist[] = {
"blink_gc/main/heap", "blink_gc/main/heap",
"blink_gc/workers/heap/worker_0x?", "blink_gc/workers/heap/worker_0x?",
"blink_objects/AdSubframe", "blink_objects/AdSubframe",
...@@ -387,9 +387,9 @@ const char* const kAllocatorDumpNameWhitelist[] = { ...@@ -387,9 +387,9 @@ const char* const kAllocatorDumpNameWhitelist[] = {
nullptr // End of list marker. nullptr // End of list marker.
}; };
const char* const* g_dump_provider_whitelist = kDumpProviderWhitelist; const char* const* g_dump_provider_allowlist = kDumpProviderAllowlist;
const char* const* g_allocator_dump_name_whitelist = const char* const* g_allocator_dump_name_allowlist =
kAllocatorDumpNameWhitelist; kAllocatorDumpNameAllowlist;
bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) { bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) {
for (size_t i = 0; list[i] != nullptr; ++i) { for (size_t i = 0; list[i] != nullptr; ++i) {
...@@ -401,12 +401,12 @@ bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) { ...@@ -401,12 +401,12 @@ bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) {
} // namespace } // namespace
bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) { bool IsMemoryDumpProviderInAllowlist(const char* mdp_name) {
return IsMemoryDumpProviderInList(mdp_name, g_dump_provider_whitelist); return IsMemoryDumpProviderInList(mdp_name, g_dump_provider_allowlist);
} }
bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) { bool IsMemoryAllocatorDumpNameInAllowlist(const std::string& name) {
// Global dumps are explicitly whitelisted for background use. // Global dumps that are of hex digits are all allowed for background use.
if (base::StartsWith(name, "global/", CompareCase::SENSITIVE)) { if (base::StartsWith(name, "global/", CompareCase::SENSITIVE)) {
for (size_t i = strlen("global/"); i < name.size(); i++) for (size_t i = strlen("global/"); i < name.size(); i++)
if (!base::IsHexDigit(name[i])) if (!base::IsHexDigit(name[i]))
...@@ -440,20 +440,20 @@ bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) { ...@@ -440,20 +440,20 @@ bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) {
} }
} }
for (size_t i = 0; g_allocator_dump_name_whitelist[i] != nullptr; ++i) { for (size_t i = 0; g_allocator_dump_name_allowlist[i] != nullptr; ++i) {
if (stripped_str == g_allocator_dump_name_whitelist[i]) { if (stripped_str == g_allocator_dump_name_allowlist[i]) {
return true; return true;
} }
} }
return false; return false;
} }
void SetDumpProviderWhitelistForTesting(const char* const* list) { void SetDumpProviderAllowlistForTesting(const char* const* list) {
g_dump_provider_whitelist = list; g_dump_provider_allowlist = list;
} }
void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) { void SetAllocatorDumpNameAllowlistForTesting(const char* const* list) {
g_allocator_dump_name_whitelist = list; g_allocator_dump_name_allowlist = list;
} }
} // namespace trace_event } // namespace trace_event
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_ #ifndef BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_
#define BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_ #define BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_
// This file contains the whitelists for background mode to limit the tracing // This file contains the allowlists (aka whitelists) for background mode to
// overhead and remove sensitive information from traces. // limit the tracing overhead and remove sensitive information from traces.
#include <string> #include <string>
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
namespace base { namespace base {
namespace trace_event { namespace trace_event {
// Checks if the given |mdp_name| is in the whitelist. // Checks if the given |mdp_name| is in the allow list.
bool BASE_EXPORT IsMemoryDumpProviderWhitelisted(const char* mdp_name); bool BASE_EXPORT IsMemoryDumpProviderInAllowlist(const char* mdp_name);
// Checks if the given |name| matches any of the whitelisted patterns. // Checks if the given |name| matches any of the allowed patterns.
bool BASE_EXPORT IsMemoryAllocatorDumpNameWhitelisted(const std::string& name); bool BASE_EXPORT IsMemoryAllocatorDumpNameInAllowlist(const std::string& name);
// The whitelist is replaced with the given list for tests. The last element of // The allow list is replaced with the given list for tests. The last element
// the list must be nullptr. // of the list must be nullptr.
void BASE_EXPORT SetDumpProviderWhitelistForTesting(const char* const* list); void BASE_EXPORT SetDumpProviderAllowlistForTesting(const char* const* list);
void BASE_EXPORT void BASE_EXPORT
SetAllocatorDumpNameWhitelistForTesting(const char* const* list); SetAllocatorDumpNameAllowlistForTesting(const char* const* list);
} // namespace trace_event } // namespace trace_event
} // namespace base } // namespace base
#endif // BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_WHITELIST_H_ #endif // BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -10,25 +10,25 @@ namespace base { ...@@ -10,25 +10,25 @@ namespace base {
namespace trace_event { namespace trace_event {
TEST(MemoryInfraBackgroundWhitelist, Whitelist) { TEST(MemoryInfraBackgroundAllowlist, Allowlist) {
// Global dumps that are of hex digits are all whitelisted for background use. // Global dumps that are of hex digits are all allowed for background use.
EXPECT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("global/01234ABCDEF")); EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("global/01234ABCDEF"));
EXPECT_TRUE( EXPECT_TRUE(
IsMemoryAllocatorDumpNameWhitelisted("shared_memory/01234ABCDEF")); IsMemoryAllocatorDumpNameInAllowlist("shared_memory/01234ABCDEF"));
// Global dumps that contain non-hex digits are not whitelisted. // Global dumps that contain non-hex digits are not in the allowlist.
EXPECT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("global/GHIJK")); EXPECT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("global/GHIJK"));
EXPECT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("shared_memory/GHIJK")); EXPECT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("shared_memory/GHIJK"));
// Test a couple that contain pointer values. // Test a couple that contain pointer values.
EXPECT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("net/url_request_context")); EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("net/url_request_context"));
EXPECT_TRUE(IsMemoryAllocatorDumpNameWhitelisted( EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist(
"net/url_request_context/app_request/0x123/cookie_monster")); "net/url_request_context/app_request/0x123/cookie_monster"));
EXPECT_TRUE( EXPECT_TRUE(
IsMemoryAllocatorDumpNameWhitelisted("net/http_network_session_0x123")); IsMemoryAllocatorDumpNameInAllowlist("net/http_network_session_0x123"));
EXPECT_FALSE( EXPECT_FALSE(
IsMemoryAllocatorDumpNameWhitelisted("net/http_network_session/0x123")); IsMemoryAllocatorDumpNameInAllowlist("net/http_network_session/0x123"));
EXPECT_TRUE(IsMemoryAllocatorDumpNameWhitelisted( EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist(
"net/http_network_session_0x123/quic_stream_factory")); "net/http_network_session_0x123/quic_stream_factory"));
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "base/memory/shared_memory_tracker.h" #include "base/memory/shared_memory_tracker.h"
#include "base/process/process_metrics.h" #include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/trace_event_impl.h" #include "base/trace_event/trace_event_impl.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
...@@ -256,7 +256,7 @@ MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal( ...@@ -256,7 +256,7 @@ MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal(
// In background mode return the black hole dump, if invalid dump name is // In background mode return the black hole dump, if invalid dump name is
// given. // given.
if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND && if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND &&
!IsMemoryAllocatorDumpNameWhitelisted(mad->absolute_name())) { !IsMemoryAllocatorDumpNameInAllowlist(mad->absolute_name())) {
return GetBlackHoleMad(); return GetBlackHoleMad();
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "base/memory/writable_shared_memory_region.h" #include "base/memory/writable_shared_memory_region.h"
#include "base/process/process_metrics.h" #include "base/process/process_metrics.h"
#include "base/trace_event/memory_allocator_dump_guid.h" #include "base/trace_event/memory_allocator_dump_guid.h"
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/trace_log.h" #include "base/trace_event/trace_log.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -384,7 +384,7 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) { ...@@ -384,7 +384,7 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) {
std::unique_ptr<ProcessMemoryDump> pmd( std::unique_ptr<ProcessMemoryDump> pmd(
new ProcessMemoryDump(background_args)); new ProcessMemoryDump(background_args));
ProcessMemoryDump::is_black_hole_non_fatal_for_testing_ = true; ProcessMemoryDump::is_black_hole_non_fatal_for_testing_ = true;
SetAllocatorDumpNameWhitelistForTesting(kTestDumpNameWhitelist); SetAllocatorDumpNameAllowlistForTesting(kTestDumpNameWhitelist);
MemoryAllocatorDump* black_hole_mad = pmd->GetBlackHoleMad(); MemoryAllocatorDump* black_hole_mad = pmd->GetBlackHoleMad();
// GetAllocatorDump works for uncreated dumps. // GetAllocatorDump works for uncreated dumps.
...@@ -428,19 +428,19 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) { ...@@ -428,19 +428,19 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) {
EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName")); EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName"));
// Test whitelisted entries. // Test whitelisted entries.
ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("Whitelisted/TestName")); ASSERT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("Whitelisted/TestName"));
// Global dumps should be whitelisted. // Global dumps should be whitelisted.
ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("global/13456")); ASSERT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("global/13456"));
// Global dumps with non-guids should not be. // Global dumps with non-guids should not be.
ASSERT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("global/random")); ASSERT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("global/random"));
// Random names should not. // Random names should not.
ASSERT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("NotWhitelisted/TestName")); ASSERT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("NotWhitelisted/TestName"));
// Check hex processing. // Check hex processing.
ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("Whitelisted/0xA1b2")); ASSERT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("Whitelisted/0xA1b2"));
} }
TEST(ProcessMemoryDumpTest, GuidsTest) { TEST(ProcessMemoryDumpTest, GuidsTest) {
......
...@@ -194,8 +194,8 @@ static_assert(41 == syncer::ModelType::NUM_ENTRIES, ...@@ -194,8 +194,8 @@ static_assert(41 == syncer::ModelType::NUM_ENTRIES,
"and suffix SyncModelType in histograms.xml."); "and suffix SyncModelType in histograms.xml.");
static_assert(41 == syncer::ModelType::NUM_ENTRIES, static_assert(41 == syncer::ModelType::NUM_ENTRIES,
"When adding a new type, update kAllocatorDumpNameWhitelist in " "When adding a new type, update kAllocatorDumpNameAllowlist in "
"base/trace_event/memory_infra_background_whitelist.cc."); "base/trace_event/memory_infra_background_allowlist.cc.");
void AddDefaultFieldValue(ModelType type, sync_pb::EntitySpecifics* specifics) { void AddDefaultFieldValue(ModelType type, sync_pb::EntitySpecifics* specifics) {
switch (type) { switch (type) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_manager_test_utils.h" #include "base/trace_event/memory_dump_manager_test_utils.h"
#include "base/trace_event/memory_dump_scheduler.h" #include "base/trace_event/memory_dump_scheduler.h"
#include "base/trace_event/memory_infra_background_whitelist.h" #include "base/trace_event/memory_infra_background_allowlist.h"
#include "base/trace_event/trace_buffer.h" #include "base/trace_event/trace_buffer.h"
#include "base/trace_event/trace_config.h" #include "base/trace_event/trace_config.h"
#include "base/trace_event/trace_config_memory_test_util.h" #include "base/trace_event/trace_config_memory_test_util.h"
...@@ -298,7 +298,7 @@ TEST_F(MemoryTracingIntegrationTest, InitializedAfterStartOfTracing) { ...@@ -298,7 +298,7 @@ TEST_F(MemoryTracingIntegrationTest, InitializedAfterStartOfTracing) {
// DETAILED, even if requested explicitly. // DETAILED, even if requested explicitly.
TEST_F(MemoryTracingIntegrationTest, TestBackgroundTracingSetup) { TEST_F(MemoryTracingIntegrationTest, TestBackgroundTracingSetup) {
InitializeClientProcess(mojom::ProcessType::BROWSER); InitializeClientProcess(mojom::ProcessType::BROWSER);
base::trace_event::SetDumpProviderWhitelistForTesting(kTestMDPWhitelist); base::trace_event::SetDumpProviderAllowlistForTesting(kTestMDPWhitelist);
auto mdp = std::make_unique<MockMemoryDumpProvider>(); auto mdp = std::make_unique<MockMemoryDumpProvider>();
RegisterDumpProvider(&*mdp, nullptr, MemoryDumpProvider::Options(), RegisterDumpProvider(&*mdp, nullptr, MemoryDumpProvider::Options(),
kWhitelistedMDPName); kWhitelistedMDPName);
...@@ -444,7 +444,7 @@ TEST_F(MemoryTracingIntegrationTest, PeriodicDumpingWithMultipleModes) { ...@@ -444,7 +444,7 @@ TEST_F(MemoryTracingIntegrationTest, PeriodicDumpingWithMultipleModes) {
TEST_F(MemoryTracingIntegrationTest, TestWhitelistingMDP) { TEST_F(MemoryTracingIntegrationTest, TestWhitelistingMDP) {
InitializeClientProcess(mojom::ProcessType::RENDERER); InitializeClientProcess(mojom::ProcessType::RENDERER);
base::trace_event::SetDumpProviderWhitelistForTesting(kTestMDPWhitelist); base::trace_event::SetDumpProviderAllowlistForTesting(kTestMDPWhitelist);
std::unique_ptr<MockMemoryDumpProvider> mdp1(new MockMemoryDumpProvider); std::unique_ptr<MockMemoryDumpProvider> mdp1(new MockMemoryDumpProvider);
RegisterDumpProvider(mdp1.get(), nullptr); RegisterDumpProvider(mdp1.get(), nullptr);
std::unique_ptr<MockMemoryDumpProvider> mdp2(new MockMemoryDumpProvider); std::unique_ptr<MockMemoryDumpProvider> mdp2(new MockMemoryDumpProvider);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment