Commit e563a035 authored by Siddhartha's avatar Siddhartha Committed by Commit Bot

GetAllocatorDump should not return black hold dump

GetAllocatorDump is used to check if dump was created. Do not return
black hole dump from here.

BUG=854668

Change-Id: Ife41be2622e9476d8e45586ace3ea316012341c3
Reviewed-on: https://chromium-review.googlesource.com/1111017
Commit-Queue: Helen Li <xunjieli@chromium.org>
Reviewed-by: default avatarHelen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569596}
parent 8cda88a0
...@@ -272,8 +272,6 @@ MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump( ...@@ -272,8 +272,6 @@ MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump(
auto it = allocator_dumps_.find(absolute_name); auto it = allocator_dumps_.find(absolute_name);
if (it != allocator_dumps_.end()) if (it != allocator_dumps_.end())
return it->second.get(); return it->second.get();
if (black_hole_mad_)
return black_hole_mad_.get();
return nullptr; return nullptr;
} }
......
...@@ -386,6 +386,10 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) { ...@@ -386,6 +386,10 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) {
SetAllocatorDumpNameWhitelistForTesting(kTestDumpNameWhitelist); SetAllocatorDumpNameWhitelistForTesting(kTestDumpNameWhitelist);
MemoryAllocatorDump* black_hole_mad = pmd->GetBlackHoleMad(); MemoryAllocatorDump* black_hole_mad = pmd->GetBlackHoleMad();
// GetAllocatorDump works for uncreated dumps.
EXPECT_EQ(nullptr, pmd->GetAllocatorDump("NotWhitelisted/TestName"));
EXPECT_EQ(nullptr, pmd->GetAllocatorDump("Whitelisted/TestName"));
// Invalid dump names. // Invalid dump names.
EXPECT_EQ(black_hole_mad, EXPECT_EQ(black_hole_mad,
pmd->CreateAllocatorDump("NotWhitelisted/TestName")); pmd->CreateAllocatorDump("NotWhitelisted/TestName"));
...@@ -419,7 +423,7 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) { ...@@ -419,7 +423,7 @@ TEST(ProcessMemoryDumpTest, BackgroundModeTest) {
pmd->CreateAllocatorDump("Whitelisted/0xaB/TestName")); pmd->CreateAllocatorDump("Whitelisted/0xaB/TestName"));
// GetAllocatorDump is consistent. // GetAllocatorDump is consistent.
EXPECT_EQ(black_hole_mad, pmd->GetAllocatorDump("NotWhitelisted/TestName")); EXPECT_EQ(nullptr, pmd->GetAllocatorDump("NotWhitelisted/TestName"));
EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName")); EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName"));
// Test whitelisted entries. // Test whitelisted entries.
......
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