| Index: base/trace_event/heap_profiler_heap_dump_writer_unittest.cc
|
| diff --git a/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc b/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc
|
| index e7850a142cb735fe6700a1b54db94449185ddb41..8faa5cf2f91a1be164bf5973f6b17c0466766f80 100644
|
| --- a/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc
|
| +++ b/base/trace_event/heap_profiler_heap_dump_writer_unittest.cc
|
| @@ -22,15 +22,13 @@
|
|
|
| namespace {
|
|
|
| -using base::trace_event::StackFrame;
|
| -
|
| // Define all strings once, because the deduplicator requires pointer equality,
|
| // and string interning is unreliable.
|
| -StackFrame kBrowserMain = StackFrame::FromTraceEventName("BrowserMain");
|
| -StackFrame kRendererMain = StackFrame::FromTraceEventName("RendererMain");
|
| -StackFrame kCreateWidget = StackFrame::FromTraceEventName("CreateWidget");
|
| -StackFrame kInitialize = StackFrame::FromTraceEventName("Initialize");
|
| -StackFrame kGetBitmap = StackFrame::FromTraceEventName("GetBitmap");
|
| +const char kBrowserMain[] = "BrowserMain";
|
| +const char kRendererMain[] = "RendererMain";
|
| +const char kCreateWidget[] = "CreateWidget";
|
| +const char kInitialize[] = "Initialize";
|
| +const char kGetBitmap[] = "GetBitmap";
|
|
|
| const char kInt[] = "int";
|
| const char kBool[] = "bool";
|
| @@ -180,10 +178,9 @@
|
| TEST(HeapDumpWriterTest, BacktraceTypeNameTable) {
|
| hash_map<AllocationContext, AllocationMetrics> metrics_by_context;
|
|
|
| - AllocationContext ctx;
|
| + AllocationContext ctx = AllocationContext::Empty();
|
| ctx.backtrace.frames[0] = kBrowserMain;
|
| ctx.backtrace.frames[1] = kCreateWidget;
|
| - ctx.backtrace.frame_count = 2;
|
| ctx.type_name = kInt;
|
|
|
| // 10 bytes with context { type: int, bt: [BrowserMain, CreateWidget] }.
|
| @@ -196,7 +193,6 @@
|
|
|
| ctx.backtrace.frames[0] = kRendererMain;
|
| ctx.backtrace.frames[1] = kInitialize;
|
| - ctx.backtrace.frame_count = 2;
|
|
|
| // 30 bytes with context { type: bool, bt: [RendererMain, Initialize] }.
|
| metrics_by_context[ctx] = {30, 30};
|
| @@ -271,22 +267,19 @@
|
| TEST(HeapDumpWriterTest, InsignificantValuesNotDumped) {
|
| hash_map<AllocationContext, AllocationMetrics> metrics_by_context;
|
|
|
| - AllocationContext ctx;
|
| + AllocationContext ctx = AllocationContext::Empty();
|
| ctx.backtrace.frames[0] = kBrowserMain;
|
| ctx.backtrace.frames[1] = kCreateWidget;
|
| - ctx.backtrace.frame_count = 2;
|
|
|
| // 0.5 KiB and 1 chunk in BrowserMain -> CreateWidget itself.
|
| metrics_by_context[ctx] = {512, 1};
|
|
|
| // 1 MiB and 1 chunk in BrowserMain -> CreateWidget -> GetBitmap.
|
| ctx.backtrace.frames[2] = kGetBitmap;
|
| - ctx.backtrace.frame_count = 3;
|
| metrics_by_context[ctx] = {1024 * 1024, 1};
|
|
|
| // 0.5 KiB and 1 chunk in BrowserMain -> CreateWidget -> Initialize.
|
| ctx.backtrace.frames[2] = kInitialize;
|
| - ctx.backtrace.frame_count = 3;
|
| metrics_by_context[ctx] = {512, 1};
|
|
|
| auto sf_deduplicator = WrapUnique(new StackFrameDeduplicator);
|
|
|