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

Unified Diff: base/trace_event/heap_profiler_allocation_register_unittest.cc

Issue 1891543003: [tracing] Turn StackFrame into struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add "the ones closer to main()" 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_allocation_register_unittest.cc
diff --git a/base/trace_event/heap_profiler_allocation_register_unittest.cc b/base/trace_event/heap_profiler_allocation_register_unittest.cc
index ceaff6e062fecf3165828350a7a415d11caf30a3..b356aa7853bc7e0e1e52c72df82e77fc8f40cf9f 100644
--- a/base/trace_event/heap_profiler_allocation_register_unittest.cc
+++ b/base/trace_event/heap_profiler_allocation_register_unittest.cc
@@ -57,7 +57,7 @@ size_t SumAllSizes(const AllocationRegister& reg) {
TEST_F(AllocationRegisterTest, InsertRemove) {
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
// Zero-sized allocations should be discarded.
reg.Insert(reinterpret_cast<void*>(1), 0, ctx);
@@ -91,7 +91,7 @@ TEST_F(AllocationRegisterTest, InsertRemove) {
TEST_F(AllocationRegisterTest, DoubleFreeIsAllowed) {
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
reg.Insert(reinterpret_cast<void*>(1), 1, ctx);
reg.Insert(reinterpret_cast<void*>(2), 1, ctx);
@@ -106,9 +106,11 @@ TEST_F(AllocationRegisterTest, DoubleInsertOverwrites) {
// TODO(ruuda): Although double insert happens in practice, it should not.
// Find out the cause and ban double insert if possible.
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
- StackFrame frame1 = "Foo";
- StackFrame frame2 = "Bar";
+ AllocationContext ctx;
+ StackFrame frame1 = StackFrame::FromTraceEventName("Foo");
+ StackFrame frame2 = StackFrame::FromTraceEventName("Bar");
+
+ ctx.backtrace.frame_count = 1;
ctx.backtrace.frames[0] = frame1;
reg.Insert(reinterpret_cast<void*>(1), 11, ctx);
@@ -138,7 +140,7 @@ TEST_F(AllocationRegisterTest, DoubleInsertOverwrites) {
TEST_F(AllocationRegisterTest, InsertRemoveCollisions) {
size_t expected_sum = 0;
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
// By inserting 100 more entries than the number of buckets, there will be at
// least 100 collisions.
@@ -175,7 +177,7 @@ TEST_F(AllocationRegisterTest, InsertRemoveCollisions) {
TEST_F(AllocationRegisterTest, InsertRemoveRandomOrder) {
size_t expected_sum = 0;
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
uintptr_t generator = 3;
uintptr_t prime = 1013;
@@ -216,7 +218,7 @@ TEST_F(AllocationRegisterTest, ChangeContextAfterInsertion) {
using Allocation = AllocationRegister::Allocation;
const char kStdString[] = "std::string";
AllocationRegister reg;
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
reg.Insert(reinterpret_cast<void*>(17), 1, ctx);
reg.Insert(reinterpret_cast<void*>(19), 2, ctx);
@@ -264,7 +266,7 @@ TEST_F(AllocationRegisterTest, ChangeContextAfterInsertion) {
TEST_F(AllocationRegisterTest, OverflowDeathTest) {
// Use a smaller register to prevent OOM errors on low-end devices.
AllocationRegister reg(static_cast<uint32_t>(GetNumCellsPerPage()));
- AllocationContext ctx = AllocationContext::Empty();
+ AllocationContext ctx;
uintptr_t i;
// Fill up all of the memory allocated for the register. |GetNumCells(reg)|

Powered by Google App Engine
This is Rietveld 408576698