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

Side by Side Diff: components/browser_watcher/postmortem_report_extractor.cc

Issue 2767193002: Postmortem report collection: validate internal state (Closed)
Patch Set: Address comment Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/debug/activity_analyzer.h" 12 #include "base/debug/activity_analyzer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "components/browser_watcher/stability_data_names.h" 19 #include "components/browser_watcher/stability_data_names.h"
19 #include "components/variations/active_field_trials.h" 20 #include "components/variations/active_field_trials.h"
20 #include "third_party/crashpad/crashpad/util/misc/uuid.h" 21 #include "third_party/crashpad/crashpad/util/misc/uuid.h"
21 22
22 namespace browser_watcher { 23 namespace browser_watcher {
23 24
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ActivityUserData::Snapshot process_data_snapshot = 223 ActivityUserData::Snapshot process_data_snapshot =
223 global_analyzer->GetProcessDataSnapshot(pid); 224 global_analyzer->GetProcessDataSnapshot(pid);
224 225
225 ThreadActivityAnalyzer* thread_analyzer = 226 ThreadActivityAnalyzer* thread_analyzer =
226 global_analyzer->GetFirstAnalyzer(pid); 227 global_analyzer->GetFirstAnalyzer(pid);
227 if (log_messages.empty() && process_data_snapshot.empty() && 228 if (log_messages.empty() && process_data_snapshot.empty() &&
228 !thread_analyzer) { 229 !thread_analyzer) {
229 return DEBUG_FILE_NO_DATA; 230 return DEBUG_FILE_NO_DATA;
230 } 231 }
231 232
233 report->set_is_complete(global_analyzer->IsDataComplete());
234
232 // Collect log messages. 235 // Collect log messages.
233 for (const std::string& message : log_messages) { 236 for (const std::string& message : log_messages) {
234 report->add_log_messages(message); 237 report->add_log_messages(message);
235 } 238 }
236 239
237 // Collect global user data. 240 // Collect global user data.
238 google::protobuf::Map<std::string, TypedValue>& global_data = 241 google::protobuf::Map<std::string, TypedValue>& global_data =
239 *(report->mutable_global_data()); 242 *(report->mutable_global_data());
240 CollectUserData(process_data_snapshot, &global_data, report); 243 CollectUserData(process_data_snapshot, &global_data, report);
241 244
(...skipping 17 matching lines...) Expand all
259 CollectThread(thread_analyzer->activity_snapshot(), thread_state); 262 CollectThread(thread_analyzer->activity_snapshot(), thread_state);
260 } 263 }
261 264
262 // Collect module information. 265 // Collect module information.
263 CollectModuleInformation(global_analyzer->GetModules(), process_state); 266 CollectModuleInformation(global_analyzer->GetModules(), process_state);
264 267
265 return SUCCESS; 268 return SUCCESS;
266 } 269 }
267 270
268 } // namespace browser_watcher 271 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « components/browser_watcher/postmortem_report_collector_unittest.cc ('k') | components/browser_watcher/stability_report.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698