Index: base/debug/activity_tracker.cc |
diff --git a/base/debug/activity_tracker.cc b/base/debug/activity_tracker.cc |
index 59b63526488ffaa780c364e602027b1ac89fcc68..a1c05c1697339cda05c616c3598f4d0fc7a7734d 100644 |
--- a/base/debug/activity_tracker.cc |
+++ b/base/debug/activity_tracker.cc |
@@ -858,6 +858,19 @@ void GlobalActivityTracker::ReleaseUserDataMemory( |
*reference = PersistentMemoryAllocator::kReferenceNull; |
} |
+void GlobalActivityTracker::RecordLogMessage(StringPiece message) { |
+ // Allocate at least one extra byte so the string is NUL terminated. All |
+ // memory returned by the allocator is guaranteed to be zeroed. |
+ PersistentMemoryAllocator::Reference ref = |
+ allocator_->Allocate(message.size() + 1, kTypeIdGlobalLogMessage); |
+ 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) |