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: Ie94279d0272d1ee403f7d32afb7e9394b403e07b
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>
GitOrigin-RevId: 87515bc2fa7f3b840068a6b0306358d5d8ecc955
diff --git a/client/crashpad_client.h b/client/crashpad_client.h
index 8576427..594f307 100644
--- a/client/crashpad_client.h
+++ b/client/crashpad_client.h
@@ -467,6 +467,22 @@
       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.
diff --git a/client/crashpad_client_ios.cc b/client/crashpad_client_ios.cc
index 673475c..a40786b 100644
--- a/client/crashpad_client_ios.cc
+++ b/client/crashpad_client_ios.cc
@@ -53,6 +53,9 @@
     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() {}
 
+// static
 void CrashpadClient::StartCrashpadInProcessHandler(
     const base::FilePath& database,
     const std::string& url,
@@ -222,10 +226,19 @@
 }
 
 // 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