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

Unified Diff: base/debug/activity_tracker.cc

Issue 2544853003: Store log messages in global activity tracker. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « base/debug/activity_tracker.h ('k') | base/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « base/debug/activity_tracker.h ('k') | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698