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

Unified Diff: components/browser_watcher/postmortem_report_extractor.cc

Issue 2767193002: Postmortem report collection: validate internal state (Closed)
Patch Set: Created 3 years, 9 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: components/browser_watcher/postmortem_report_extractor.cc
diff --git a/components/browser_watcher/postmortem_report_extractor.cc b/components/browser_watcher/postmortem_report_extractor.cc
index bd12a9a03b4b87f9892195c6a3806bd1d6fce629..3a150b44e0241c11fc49eafbfef73e900b25d3db 100644
--- a/components/browser_watcher/postmortem_report_extractor.cc
+++ b/components/browser_watcher/postmortem_report_extractor.cc
@@ -11,6 +11,8 @@
#include "base/debug/activity_analyzer.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/metrics/persistent_memory_allocator.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -213,6 +215,16 @@ CollectionStatus Extract(const base::FilePath& stability_file,
if (!global_analyzer)
return ANALYZER_CREATION_FAILED;
+ uint8_t allocator_state = global_analyzer->allocator().GetMemoryState();
bcwhite 2017/03/23 11:32:44 I think it would be better to add a GetMemoryState
bcwhite 2017/03/23 11:35:40 Make that... MEMORY_FULL = 100, // MEMORY_USER
manzagop (departed) 2017/03/23 19:18:54 Acknowledged.
manzagop (departed) 2017/03/23 19:18:54 Hm, maybe it's best to decouple the two. Tell me w
bcwhite 2017/03/23 21:10:43 The memory state was written expecting that it wou
manzagop (departed) 2017/03/23 21:25:02 I'm not sure I follow. Here are the main things: -
bcwhite 2017/03/24 12:49:04 If you ignore the implementation details, you can
+ if (allocator_state == base::PersistentMemoryAllocator::MEMORY_UNINITIALIZED)
+ return ALLOCATOR_UNINITIALIZED;
+ if (allocator_state == base::PersistentMemoryAllocator::MEMORY_DELETED)
+ return ALLOCATOR_DELETED;
+ if (global_analyzer->allocator().IsCorrupt())
+ return ALLOCATOR_CORRUPT;
+ UMA_HISTOGRAM_BOOLEAN("ActivityTracker.Collect.IsAllocatorFull",
bcwhite 2017/03/23 11:32:44 I think it would be better to just enable the inte
manzagop (departed) 2017/03/23 19:18:54 Removed the fullness histogram. Will the histogram
bcwhite 2017/03/23 21:10:43 They're specific to the allocator's name: UMA.Per
manzagop (departed) 2017/03/23 21:25:02 Great!
+ global_analyzer->allocator().IsFull());
+
// Early exit if there is no data.
std::vector<std::string> log_messages = global_analyzer->GetLogMessages();
ActivityUserData::Snapshot global_data_snapshot =

Powered by Google App Engine
This is Rietveld 408576698