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

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

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

Powered by Google App Engine
This is Rietveld 408576698