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

Unified Diff: components/browser_watcher/postmortem_report_collector.cc

Issue 2554423002: Collect log messages from stability files (Closed)
Patch Set: Revise comments 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
Index: components/browser_watcher/postmortem_report_collector.cc
diff --git a/components/browser_watcher/postmortem_report_collector.cc b/components/browser_watcher/postmortem_report_collector.cc
index cb323d4cfd19237431821f232a4fa294f5d42af1..4812179e7bf498685bcae398971f42f6e5a43d05 100644
--- a/components/browser_watcher/postmortem_report_collector.cc
+++ b/components/browser_watcher/postmortem_report_collector.cc
@@ -100,7 +100,8 @@ PostmortemReportCollector::CollectAndSubmit(
// Note: the code below involves two notions of report: chrome internal state
// reports and the crashpad reports they get wrapped into.
- // Collect the data from the debug file to a proto.
+ // Collect the data from the debug file to a proto. Note: a non-empty report
+ // is interpreted here as an unclean exit.
std::unique_ptr<StabilityReport> report_proto;
CollectionStatus status = Collect(file, &report_proto);
if (status != SUCCESS) {
@@ -167,17 +168,23 @@ PostmortemReportCollector::CollectionStatus PostmortemReportCollector::Collect(
return ANALYZER_CREATION_FAILED;
// Early exit if there is no data.
+ std::vector<std::string> log_messages = global_analyzer->GetLogMessages();
ThreadActivityAnalyzer* thread_analyzer = global_analyzer->GetFirstAnalyzer();
- if (!thread_analyzer) {
- // No data. This case happens in the case of a clean exit.
+ if (log_messages.empty() && !thread_analyzer) {
return DEBUG_FILE_NO_DATA;
}
- // Iterate through the thread analyzers, fleshing out the report.
+ // Create the report, then flesh it out.
report->reset(new StabilityReport());
+
+ // Collect log messages.
+ for (const std::string& message : log_messages) {
+ (*report)->add_log_messages(message);
+ }
+
+ // Collect thread activity data.
// Note: a single process is instrumented.
ProcessState* process_state = (*report)->add_process_states();
-
for (; thread_analyzer != nullptr;
thread_analyzer = global_analyzer->GetNextAnalyzer()) {
// Only valid analyzers are expected per contract of GetFirstAnalyzer /

Powered by Google App Engine
This is Rietveld 408576698