mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-15 01:57:58 +08:00
[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:
parent
77b2b2f1d0
commit
5081a90207
@ -56,19 +56,6 @@ class ScopedThreadResumeAfterException {
|
|||||||
|
|
||||||
} // namespace
|
} // 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(
|
CrashReportExceptionHandler::CrashReportExceptionHandler(
|
||||||
CrashReportDatabase* database,
|
CrashReportDatabase* database,
|
||||||
CrashReportUploadThread* upload_thread,
|
CrashReportUploadThread* upload_thread,
|
||||||
@ -78,8 +65,7 @@ CrashReportExceptionHandler::CrashReportExceptionHandler(
|
|||||||
: database_(database),
|
: database_(database),
|
||||||
upload_thread_(upload_thread),
|
upload_thread_(upload_thread),
|
||||||
process_annotations_(process_annotations),
|
process_annotations_(process_annotations),
|
||||||
process_attachments_(nullptr),
|
process_attachments_(process_attachments),
|
||||||
process_attachments_vmo_(process_attachments),
|
|
||||||
user_stream_data_sources_(user_stream_data_sources) {}
|
user_stream_data_sources_(user_stream_data_sources) {}
|
||||||
|
|
||||||
CrashReportExceptionHandler::~CrashReportExceptionHandler() {}
|
CrashReportExceptionHandler::~CrashReportExceptionHandler() {}
|
||||||
@ -179,28 +165,11 @@ bool CrashReportExceptionHandler::HandleExceptionHandles(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(DX-1270): remove once callers have switched to passing VMOs.
|
|
||||||
if (process_attachments_) {
|
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
|
// 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
|
// 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).
|
// 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.
|
// TODO(frousseau): make FileWriter VMO-aware.
|
||||||
FileWriter* writer = new_report->AddAttachment(it.first);
|
FileWriter* writer = new_report->AddAttachment(it.first);
|
||||||
if (!writer) {
|
if (!writer) {
|
||||||
|
@ -38,38 +38,6 @@ namespace crashpad {
|
|||||||
//! to a CrashReportDatabase.
|
//! to a CrashReportDatabase.
|
||||||
class CrashReportExceptionHandler {
|
class CrashReportExceptionHandler {
|
||||||
public:
|
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 it’s 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.
|
//! \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] database The database to store crash reports in. Weak.
|
||||||
@ -145,10 +113,8 @@ class CrashReportExceptionHandler {
|
|||||||
CrashReportDatabase* database_; // weak
|
CrashReportDatabase* database_; // weak
|
||||||
CrashReportUploadThread* upload_thread_; // weak
|
CrashReportUploadThread* upload_thread_; // weak
|
||||||
const std::map<std::string, std::string>* process_annotations_; // 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>*
|
const std::map<std::string, fuchsia::mem::Buffer>*
|
||||||
process_attachments_vmo_; // weak
|
process_attachments_; // weak
|
||||||
const UserStreamDataSources* user_stream_data_sources_; // weak
|
const UserStreamDataSources* user_stream_data_sources_; // weak
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CrashReportExceptionHandler);
|
DISALLOW_COPY_AND_ASSIGN(CrashReportExceptionHandler);
|
||||||
|
@ -874,7 +874,7 @@ int HandlerMain(int argc,
|
|||||||
&options.annotations,
|
&options.annotations,
|
||||||
#if defined(OS_FUCHSIA)
|
#if defined(OS_FUCHSIA)
|
||||||
// TODO(scottmg): Process level file attachments, and for all platforms.
|
// TODO(scottmg): Process level file attachments, and for all platforms.
|
||||||
static_cast<std::map<std::string, base::FilePath>*>(nullptr),
|
nullptr,
|
||||||
#endif
|
#endif
|
||||||
user_stream_sources);
|
user_stream_sources);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user