OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/browser_watcher/postmortem_report_extractor.h" | 5 #include "components/browser_watcher/postmortem_report_extractor.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // Create a global analyzer. | 210 // Create a global analyzer. |
211 std::unique_ptr<GlobalActivityAnalyzer> global_analyzer = | 211 std::unique_ptr<GlobalActivityAnalyzer> global_analyzer = |
212 GlobalActivityAnalyzer::CreateWithFile(stability_file); | 212 GlobalActivityAnalyzer::CreateWithFile(stability_file); |
213 if (!global_analyzer) | 213 if (!global_analyzer) |
214 return ANALYZER_CREATION_FAILED; | 214 return ANALYZER_CREATION_FAILED; |
215 | 215 |
216 // Early exit if there is no data. | 216 // Early exit if there is no data. |
217 std::vector<std::string> log_messages = global_analyzer->GetLogMessages(); | 217 std::vector<std::string> log_messages = global_analyzer->GetLogMessages(); |
218 ActivityUserData::Snapshot global_data_snapshot = | 218 ActivityUserData::Snapshot global_data_snapshot = |
219 global_analyzer->GetGlobalUserDataSnapshot(); | 219 global_analyzer->GetGlobalDataSnapshot(); |
220 ThreadActivityAnalyzer* thread_analyzer = global_analyzer->GetFirstAnalyzer(); | 220 |
| 221 // Extract data for only the first process. |
| 222 // TODO(manzagop): Extend this to all processes. |
| 223 int64_t pid = global_analyzer->GetFirstProcess(); |
| 224 ThreadActivityAnalyzer* thread_analyzer = |
| 225 global_analyzer->GetFirstAnalyzer(pid); |
221 if (log_messages.empty() && global_data_snapshot.empty() && | 226 if (log_messages.empty() && global_data_snapshot.empty() && |
222 !thread_analyzer) { | 227 !thread_analyzer) { |
223 return DEBUG_FILE_NO_DATA; | 228 return DEBUG_FILE_NO_DATA; |
224 } | 229 } |
225 | 230 |
226 // Collect log messages. | 231 // Collect log messages. |
227 for (const std::string& message : log_messages) { | 232 for (const std::string& message : log_messages) { |
228 report->add_log_messages(message); | 233 report->add_log_messages(message); |
229 } | 234 } |
230 | 235 |
(...skipping 22 matching lines...) Expand all Loading... |
253 CollectThread(thread_analyzer->activity_snapshot(), thread_state); | 258 CollectThread(thread_analyzer->activity_snapshot(), thread_state); |
254 } | 259 } |
255 | 260 |
256 // Collect module information. | 261 // Collect module information. |
257 CollectModuleInformation(global_analyzer->GetModules(), process_state); | 262 CollectModuleInformation(global_analyzer->GetModules(), process_state); |
258 | 263 |
259 return SUCCESS; | 264 return SUCCESS; |
260 } | 265 } |
261 | 266 |
262 } // namespace browser_watcher | 267 } // namespace browser_watcher |
OLD | NEW |