@@ -45,7 +45,7 @@ CrashReportExceptionHandler::CrashReportExceptionHandler(
4545 : database_(database),
4646 upload_thread_ (upload_thread),
4747 process_annotations_(process_annotations),
48- attachments_(attachments),
48+ attachments_(* attachments),
4949 screenshot_(screenshot),
5050 wait_for_upload_(wait_for_upload),
5151 user_stream_data_sources_(user_stream_data_sources) {}
@@ -117,7 +117,7 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
117117 return termination_code;
118118 }
119119
120- for (const auto & attachment : (* attachments_) ) {
120+ for (const auto & attachment : attachments_) {
121121 FileReader file_reader;
122122 if (!file_reader.Open (attachment)) {
123123 LOG (ERROR) << " attachment " << attachment
@@ -175,4 +175,24 @@ unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException(
175175 return termination_code;
176176}
177177
178+ void CrashReportExceptionHandler::ExceptionHandlerServerAttachmentAdded (
179+ const base::FilePath& attachment) {
180+ auto it = std::find (attachments_.begin (), attachments_.end (), attachment);
181+ if (it != attachments_.end ()) {
182+ LOG (WARNING) << " ignoring duplicate attachment " << attachment;
183+ return ;
184+ }
185+ attachments_.push_back (attachment);
186+ }
187+
188+ void CrashReportExceptionHandler::ExceptionHandlerServerAttachmentRemoved (
189+ const base::FilePath& attachment) {
190+ auto it = std::find (attachments_.begin (), attachments_.end (), attachment);
191+ if (it == attachments_.end ()) {
192+ LOG (WARNING) << " ignoring non-existent attachment " << attachment;
193+ return ;
194+ }
195+ attachments_.erase (it);
196+ }
197+
178198} // namespace crashpad
0 commit comments