Chromium Code Reviews| Index: base/debug/activity_tracker.cc |
| diff --git a/base/debug/activity_tracker.cc b/base/debug/activity_tracker.cc |
| index 59b63526488ffaa780c364e602027b1ac89fcc68..dd1f33b03f0fe169bd1d88343abe5aad88863fd1 100644 |
| --- a/base/debug/activity_tracker.cc |
| +++ b/base/debug/activity_tracker.cc |
| @@ -858,6 +858,17 @@ void GlobalActivityTracker::ReleaseUserDataMemory( |
| *reference = PersistentMemoryAllocator::kReferenceNull; |
| } |
| +void GlobalActivityTracker::RecordLogMessage(StringPiece message) { |
| + PersistentMemoryAllocator::Reference ref = |
|
manzagop (departed)
2016/12/02 19:10:41
Wdyt of setting a max size that we'll truncate to?
bcwhite
2016/12/02 19:28:07
If it's somehow too big, the allocation will fail
manzagop (departed)
2016/12/02 20:08:09
Yeah, the worry is if it's too big then you get no
bcwhite
2016/12/02 20:16:30
Somewhat related: You should report the IsFull()
manzagop (departed)
2016/12/02 20:50:09
Thanks for the heads up! Added to the list.
|
| + allocator_->Allocate(message.size() + 1, kTypeIdGlobalLogMessage); |
|
manzagop (departed)
2016/12/02 19:10:41
The extra character is to ensure null termination,
bcwhite
2016/12/02 19:28:07
Done.
|
| + char* memory = allocator_->GetAsArray<char>(ref, kTypeIdGlobalLogMessage, |
| + message.size() + 1); |
| + if (memory) { |
| + memcpy(memory, message.data(), message.size()); |
| + allocator_->MakeIterable(ref); |
| + } |
| +} |
| + |
| GlobalActivityTracker::GlobalActivityTracker( |
| std::unique_ptr<PersistentMemoryAllocator> allocator, |
| int stack_depth) |