[fuchsia] delete old way of passing attachments

* Fuchsia has switched to passing VMOs directly

Bug: fuchsia:DX-1270
Change-Id: I8114a87d895602e80757b87cbeb884b62cfae57f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1562180
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
This commit is contained in:
Francois Rousseau 2019-04-10 13:14:43 -07:00 committed by Commit Bot
parent 77b2b2f1d0
commit 5081a90207
3 changed files with 4 additions and 69 deletions

View File

@ -56,19 +56,6 @@ class ScopedThreadResumeAfterException {
} // namespace
CrashReportExceptionHandler::CrashReportExceptionHandler(
CrashReportDatabase* database,
CrashReportUploadThread* upload_thread,
const std::map<std::string, std::string>* process_annotations,
const std::map<std::string, base::FilePath>* process_attachments,
const UserStreamDataSources* user_stream_data_sources)
: database_(database),
upload_thread_(upload_thread),
process_annotations_(process_annotations),
process_attachments_(process_attachments),
process_attachments_vmo_(nullptr),
user_stream_data_sources_(user_stream_data_sources) {}
CrashReportExceptionHandler::CrashReportExceptionHandler(
CrashReportDatabase* database,
CrashReportUploadThread* upload_thread,
@ -78,8 +65,7 @@ CrashReportExceptionHandler::CrashReportExceptionHandler(
: database_(database),
upload_thread_(upload_thread),
process_annotations_(process_annotations),
process_attachments_(nullptr),
process_attachments_vmo_(process_attachments),
process_attachments_(process_attachments),
user_stream_data_sources_(user_stream_data_sources) {}
CrashReportExceptionHandler::~CrashReportExceptionHandler() {}
@ -179,28 +165,11 @@ bool CrashReportExceptionHandler::HandleExceptionHandles(
return false;
}
// TODO(DX-1270): remove once callers have switched to passing VMOs.
if (process_attachments_) {
// Note that attachments are read at this point each time rather than once
// so that if the contents of the file has changed it will be re-read for
// each upload (e.g. in the case of a log file).
for (const auto& it : *process_attachments_) {
FileWriter* writer = new_report->AddAttachment(it.first);
if (writer) {
std::string contents;
if (!LoggingReadEntireFile(it.second, &contents)) {
// Not being able to read the file isn't considered fatal, and
// should not prevent the report from being processed.
continue;
}
writer->Write(contents.data(), contents.size());
}
}
} else if (process_attachments_vmo_) {
// Note that attachments are read at this point each time rather than once
// so that if the contents of the VMO has changed it will be re-read for
// each upload (e.g. in the case of a log file).
for (const auto& it : *process_attachments_vmo_) {
for (const auto& it : *process_attachments_) {
// TODO(frousseau): make FileWriter VMO-aware.
FileWriter* writer = new_report->AddAttachment(it.first);
if (!writer) {

View File

@ -38,38 +38,6 @@ namespace crashpad {
//! to a CrashReportDatabase.
class CrashReportExceptionHandler {
public:
//! \brief Creates a new object that will store crash reports in \a database.
//!
//! \param[in] database The database to store crash reports in. Weak.
//! \param[in] upload_thread The upload thread to notify when a new crash
//! report is written into \a database.
//! \param[in] process_annotations A map of annotations to insert as
//! process-level annotations into each crash report that is written. Do
//! not confuse this with module-level annotations, which are under the
//! control of the crashing process, and are used to implement Chrome's
//! "crash keys." Process-level annotations are those that are beyond the
//! control of the crashing process, which must reliably be set even if
//! the process crashes before its able to establish its own annotations.
//! To interoperate with Breakpad servers, the recommended practice is to
//! specify values for the `"prod"` and `"ver"` keys as process
//! annotations.
//! \param[in] process_attachments A map of file name keys to file paths to be
//! included in the report. Each time a report is written, the file paths
//! will be read in their entirety and included in the report using the
//! file name key as the name in the http upload.
//! \param[in] user_stream_data_sources Data sources to be used to extend
//! crash reports. For each crash report that is written, the data sources
//! are called in turn. These data sources may contribute additional
//! minidump streams. `nullptr` if not required.
//
// TODO(DX-1270): remove once callers have switched to passing VMOs.
CrashReportExceptionHandler(
CrashReportDatabase* database,
CrashReportUploadThread* upload_thread,
const std::map<std::string, std::string>* process_annotations,
const std::map<std::string, base::FilePath>* process_attachments,
const UserStreamDataSources* user_stream_data_sources);
//! \brief Creates a new object that will store crash reports in \a database.
//!
//! \param[in] database The database to store crash reports in. Weak.
@ -145,10 +113,8 @@ class CrashReportExceptionHandler {
CrashReportDatabase* database_; // weak
CrashReportUploadThread* upload_thread_; // weak
const std::map<std::string, std::string>* process_annotations_; // weak
// TODO(DX-1270): remove once callers have switched to passing VMOs.
const std::map<std::string, base::FilePath>* process_attachments_; // weak
const std::map<std::string, fuchsia::mem::Buffer>*
process_attachments_vmo_; // weak
process_attachments_; // weak
const UserStreamDataSources* user_stream_data_sources_; // weak
DISALLOW_COPY_AND_ASSIGN(CrashReportExceptionHandler);

View File

@ -874,7 +874,7 @@ int HandlerMain(int argc,
&options.annotations,
#if defined(OS_FUCHSIA)
// TODO(scottmg): Process level file attachments, and for all platforms.
static_cast<std::map<std::string, base::FilePath>*>(nullptr),
nullptr,
#endif
user_stream_sources);