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

Unified Diff: base/trace_event/heap_profiler_heap_dump_writer_unittest.cc

Issue 1907593002: Revert of [tracing] Turn StackFrame into struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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);
« no previous file with comments | « base/trace_event/heap_profiler_heap_dump_writer.cc ('k') | base/trace_event/heap_profiler_stack_frame_deduplicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698