Chromium Code Reviews| Index: components/browser_watcher/dump_postmortem_minidump_main_win.cc |
| diff --git a/components/browser_watcher/dump_postmortem_minidump_main_win.cc b/components/browser_watcher/dump_postmortem_minidump_main_win.cc |
| index 1b9aabe4d99ff50d14cfe76c05920a225eb880fc..5a16d9a73d749aa7ccf42e14f21c98e340a9e528 100644 |
| --- a/components/browser_watcher/dump_postmortem_minidump_main_win.cc |
| +++ b/components/browser_watcher/dump_postmortem_minidump_main_win.cc |
| @@ -33,12 +33,57 @@ bool ParseCommandLine(const base::CommandLine* cmd, |
| return true; |
| } |
| +void Indent(FILE* out, size_t indent_level) { |
| + DCHECK_NE(nullptr, out); |
|
bcwhite
2016/11/23 14:08:56
"DCHECK(out)" is fine just like "if (out)" would b
manzagop (departed)
2016/11/23 16:41:29
Done. Here and below.
|
| + for (size_t i = 0; i < indent_level; ++i) { |
|
bcwhite
2016/11/23 14:08:56
No braces for single-line loops.
manzagop (departed)
2016/11/23 16:41:29
Done.
|
| + ::fprintf(out, " "); |
|
bcwhite
2016/11/23 14:08:56
Omit ::, like elsewhere.
manzagop (departed)
2016/11/23 16:41:29
Done.
|
| + } |
| +} |
| + |
| +void PrintActivity(FILE* out, |
| + size_t indent_level, |
| + const browser_watcher::Activity& activity) { |
| + DCHECK_NE(nullptr, out); |
| + Indent(out, indent_level); |
| + fprintf(out, "Activity\n"); |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "type: %d\n", activity.type()); |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "time: %lld\n", activity.time()); |
| + switch (activity.type()) { |
| + case browser_watcher::Activity::ACT_TASK_RUN: |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "origin_address: %llx\n", activity.origin_address()); |
| + fprintf(out, "task_sequence_id: %lld\n", activity.task_sequence_id()); |
| + break; |
| + case browser_watcher::Activity::ACT_LOCK_ACQUIRE: |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "lock_address: %llx\n", activity.lock_address()); |
| + break; |
| + case browser_watcher::Activity::ACT_EVENT_WAIT: |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "event_address: %llx\n", activity.event_address()); |
| + break; |
| + case browser_watcher::Activity::ACT_THREAD_JOIN: |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "thread_id: %lld\n", activity.thread_id()); |
| + break; |
| + case browser_watcher::Activity::ACT_PROCESS_WAIT: |
| + Indent(out, indent_level + 1); |
| + fprintf(out, "process_id: %lld\n", activity.process_id()); |
| + break; |
| + } |
| +} |
| + |
| void PrintProcessState(FILE* out, |
| const browser_watcher::ProcessState& process) { |
| - fprintf(out, "%s", "Process:\n"); |
| - for (int i = 0; i < process.threads_size(); ++i) { |
| - const browser_watcher::ThreadState thread = process.threads(i); |
| - fprintf(out, "%s\n", thread.thread_name().c_str()); |
| + fprintf(out, "Process %lld (%d threads)\n", process.process_id(), |
| + process.threads_size()); |
| + for (const browser_watcher::ThreadState& thread : process.threads()) { |
| + fprintf(out, "Thread %lld (%s) : %d activities\n", thread.thread_id(), |
| + thread.thread_name().c_str(), thread.activity_count()); |
| + for (const browser_watcher::Activity& activity : thread.activities()) |
| + PrintActivity(out, 1, activity); |
| } |
| } |