ios: Expose ProcessIntermediateDumps in CrashpadClient.

This method should be called when an application is ready to start
processing previously created intermediate dumps and begin uploading.
Processing will block, so this should not be called on the main UI
thread.

Bug: crashpad: 31
Change-Id: I31f81c68694cf18dd40e2994c0d6e7107c29e553
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2673024
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Justin Cohen 2021-02-03 23:20:30 -05:00 committed by Commit Bot
parent 1f28ee77ef
commit 87515bc2fa
2 changed files with 29 additions and 0 deletions

View File

@ -467,6 +467,22 @@ class CrashpadClient {
const std::string& url,
const std::map<std::string, std::string>& annotations);
//! \brief Requests that the handler convert intermediate dumps into
//! minidumps and trigger an upload if possible.
//!
//! A handler must have already been installed before calling this method.
//! This method should be called when an application is ready to start
//! processing previously created intermediate dumps and begin uploading.
//! Processing will block, so this should not be called on the main UI thread.
//! No intermediate dumps will be processed (and therefore no minidumps will
//! uploaded) until this method (or DumpWithoutCrash) is called.
//!
//! \param[in] annotations Process annotations to set in each crash report.
//! Useful when adding crash annotations detected on the next run after a
//! crash but before upload.
void ProcessIntermediateDumps(
const std::map<std::string, std::string>& annotations = {});
// TODO(justincohen): This method is purely for bringing up iOS interfaces.
//! \brief Requests that the handler capture a dump even though there hasn't
//! been a crash.

View File

@ -53,6 +53,9 @@ class CrashHandler : public Thread, public UniversalMachExcServer::Interface {
INITIALIZATION_STATE_SET_VALID(initialized_);
}
void ProcessIntermediateDumps(
const std::map<std::string, std::string>& annotations = {}) {}
void DumpWithoutCrash(NativeCPUContext* context) {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
mach_exception_data_type_t code[2] = {};
@ -210,6 +213,7 @@ CrashpadClient::CrashpadClient() {}
CrashpadClient::~CrashpadClient() {}
// static
void CrashpadClient::StartCrashpadInProcessHandler(
const base::FilePath& database,
const std::string& url,
@ -221,11 +225,20 @@ void CrashpadClient::StartCrashpadInProcessHandler(
crash_handler->Initialize();
}
// static
void CrashpadClient::ProcessIntermediateDumps(
const std::map<std::string, std::string>& annotations) {
CrashHandler* crash_handler = CrashHandler::Get();
DCHECK(crash_handler);
crash_handler->ProcessIntermediateDumps(annotations);
}
// static
void CrashpadClient::DumpWithoutCrash(NativeCPUContext* context) {
CrashHandler* crash_handler = CrashHandler::Get();
DCHECK(crash_handler);
crash_handler->DumpWithoutCrash(context);
crash_handler->ProcessIntermediateDumps();
}
} // namespace crashpad