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

Unified Diff: base/trace_event/memory_allocator_dump_unittest.cc

Issue 1107093004: [tracing] Simplify MemoryDumpProvider interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep protected dtor Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_allocator_dump_unittest.cc
diff --git a/base/trace_event/memory_allocator_dump_unittest.cc b/base/trace_event/memory_allocator_dump_unittest.cc
index 110a25d93c44b06acc9b4a5e908740e1d081e14b..a0e39efaed30c75f558f3397c387681f499e404b 100644
--- a/base/trace_event/memory_allocator_dump_unittest.cc
+++ b/base/trace_event/memory_allocator_dump_unittest.cc
@@ -17,19 +17,12 @@ namespace {
class FakeMemoryAllocatorDumpProvider : public MemoryDumpProvider {
public:
- FakeMemoryAllocatorDumpProvider() {
- DeclareAllocatorAttribute("foobar_allocator", "attr1", "count");
- DeclareAllocatorAttribute("foobar_allocator", "attr2", "bytes");
- }
-
- bool DumpInto(ProcessMemoryDump* pmd) override {
+ bool OnMemoryDump(ProcessMemoryDump* pmd) override {
MemoryAllocatorDump* root_heap = pmd->CreateAllocatorDump(
"foobar_allocator", MemoryAllocatorDump::kRootHeap);
root_heap->set_physical_size_in_bytes(4096);
root_heap->set_allocated_objects_count(42);
root_heap->set_allocated_objects_size_in_bytes(1000);
- root_heap->SetAttribute("attr1", 1234);
- root_heap->SetAttribute("attr2", 99);
MemoryAllocatorDump* sub_heap =
pmd->CreateAllocatorDump("foobar_allocator", "sub_heap");
@@ -43,18 +36,14 @@ class FakeMemoryAllocatorDumpProvider : public MemoryDumpProvider {
return true;
}
-
- const char* GetFriendlyName() const override { return "FooBar Allocator"; }
};
} // namespace
TEST(MemoryAllocatorDumpTest, DumpIntoProcessMemoryDump) {
FakeMemoryAllocatorDumpProvider fmadp;
ProcessMemoryDump pmd(make_scoped_refptr(new MemoryDumpSessionState()));
- pmd.session_state()->allocators_attributes_type_info.Update(
- fmadp.allocator_attributes_type_info());
- fmadp.DumpInto(&pmd);
+ fmadp.OnMemoryDump(&pmd);
ASSERT_EQ(3u, pmd.allocator_dumps().size());
@@ -68,10 +57,6 @@ TEST(MemoryAllocatorDumpTest, DumpIntoProcessMemoryDump) {
EXPECT_EQ(42u, root_heap->allocated_objects_count());
EXPECT_EQ(1000u, root_heap->allocated_objects_size_in_bytes());
- // Check the extra attributes of |root_heap|.
- EXPECT_EQ(1234, root_heap->GetIntegerAttribute("attr1"));
- EXPECT_EQ(99, root_heap->GetIntegerAttribute("attr2"));
-
const MemoryAllocatorDump* sub_heap =
pmd.GetAllocatorDump("foobar_allocator", "sub_heap");
ASSERT_NE(nullptr, sub_heap);
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698