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

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

Issue 2372633002: Use the correct product/version for postmortem reports (Closed)
Patch Set: Address clang errors Created 4 years, 2 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_collector.h" 5 #include "components/browser_watcher/postmortem_report_collector.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/activity_analyzer.h" 9 #include "base/debug/activity_analyzer.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/utf_string_conversions.h"
15 #include "components/browser_watcher/postmortem_minidump_writer.h" 16 #include "components/browser_watcher/postmortem_minidump_writer.h"
16 #include "components/version_info/version_info.h"
17 #include "third_party/crashpad/crashpad/client/settings.h" 17 #include "third_party/crashpad/crashpad/client/settings.h"
18 #include "third_party/crashpad/crashpad/util/misc/uuid.h" 18 #include "third_party/crashpad/crashpad/util/misc/uuid.h"
19 19
20 using base::FilePath; 20 using base::FilePath;
21 21
22 namespace browser_watcher { 22 namespace browser_watcher {
23 23
24 using base::debug::GlobalActivityAnalyzer; 24 using base::debug::GlobalActivityAnalyzer;
25 using base::debug::ThreadActivityAnalyzer; 25 using base::debug::ThreadActivityAnalyzer;
26 using crashpad::CrashReportDatabase; 26 using crashpad::CrashReportDatabase;
27 27
28 PostmortemReportCollector::PostmortemReportCollector(
29 const std::string& product_name,
30 const std::string& version_number,
31 const std::string& channel_name)
32 : product_name_(product_name),
33 version_number_(version_number),
34 channel_name_(channel_name) {}
35
28 int PostmortemReportCollector::CollectAndSubmitForUpload( 36 int PostmortemReportCollector::CollectAndSubmitForUpload(
29 const base::FilePath& debug_info_dir, 37 const base::FilePath& debug_info_dir,
30 const base::FilePath::StringType& debug_file_pattern, 38 const base::FilePath::StringType& debug_file_pattern,
31 const std::set<base::FilePath>& excluded_debug_files, 39 const std::set<base::FilePath>& excluded_debug_files,
32 crashpad::CrashReportDatabase* report_database) { 40 crashpad::CrashReportDatabase* report_database) {
33 DCHECK_NE(true, debug_info_dir.empty()); 41 DCHECK_NE(true, debug_info_dir.empty());
34 DCHECK_NE(true, debug_file_pattern.empty()); 42 DCHECK_NE(true, debug_file_pattern.empty());
35 DCHECK_NE(nullptr, report_database); 43 DCHECK_NE(nullptr, report_database);
36 44
37 // Collect the list of files to harvest. 45 // Collect the list of files to harvest.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 191 }
184 192
185 bool PostmortemReportCollector::WriteReportToMinidump( 193 bool PostmortemReportCollector::WriteReportToMinidump(
186 const StabilityReport& report, 194 const StabilityReport& report,
187 const crashpad::UUID& client_id, 195 const crashpad::UUID& client_id,
188 const crashpad::UUID& report_id, 196 const crashpad::UUID& report_id,
189 base::PlatformFile minidump_file) { 197 base::PlatformFile minidump_file) {
190 MinidumpInfo minidump_info; 198 MinidumpInfo minidump_info;
191 minidump_info.client_id = client_id; 199 minidump_info.client_id = client_id;
192 minidump_info.report_id = report_id; 200 minidump_info.report_id = report_id;
193 minidump_info.product_name = version_info::GetProductName(); 201 // TODO(manzagop): replace this information, i.e. the reporter's attributes,
194 minidump_info.version_number = version_info::GetVersionNumber(); 202 // by that of the reportee. Doing so requires adding this information to the
203 // stability report. In the meantime, there is a tolerable information
204 // mismatch after upgrades.
205 minidump_info.product_name = product_name();
206 minidump_info.version_number = version_number();
207 minidump_info.channel_name = channel_name();
208 #if defined(ARCH_CPU_X86)
209 minidump_info.platform = std::string("Win32");
210 #elif defined(ARCH_CPU_X86_64)
211 minidump_info.platform = std::string("Win64");
212 #endif
195 213
196 return WritePostmortemDump(minidump_file, report, minidump_info); 214 return WritePostmortemDump(minidump_file, report, minidump_info);
197 } 215 }
198 216
199 } // namespace browser_watcher 217 } // namespace browser_watcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698