@@ -111,7 +111,7 @@ CrashReportExceptionHandler::CrashReportExceptionHandler(
111111 : database_(database),
112112 upload_thread_ (upload_thread),
113113 process_annotations_(process_annotations),
114- attachments_(attachments),
114+ attachments_(* attachments),
115115 write_minidump_to_database_(write_minidump_to_database),
116116 write_minidump_to_log_(write_minidump_to_log),
117117 user_stream_data_sources_(user_stream_data_sources),
@@ -210,6 +210,26 @@ bool CrashReportExceptionHandler::HandleExceptionWithConnection(
210210 return result;
211211}
212212
213+ void CrashReportExceptionHandler::AddAttachment (
214+ const base::FilePath& attachment) {
215+ auto it = std::find (attachments_.begin (), attachments_.end (), attachment);
216+ if (it != attachments_.end ()) {
217+ LOG (WARNING) << " ignoring duplicate attachment " << attachment;
218+ return ;
219+ }
220+ attachments_.push_back (attachment);
221+ }
222+
223+ void CrashReportExceptionHandler::RemoveAttachment (
224+ const base::FilePath& attachment) {
225+ auto it = std::find (attachments_.begin (), attachments_.end (), attachment);
226+ if (it == attachments_.end ()) {
227+ LOG (WARNING) << " ignoring non-existent attachment " << attachment;
228+ return ;
229+ }
230+ attachments_.erase (it);
231+ }
232+
213233bool CrashReportExceptionHandler::WriteMinidumpToDatabase (
214234 ProcessSnapshotLinux* process_snapshot,
215235 ProcessSnapshotSanitized* sanitized_snapshot,
@@ -252,7 +272,7 @@ bool CrashReportExceptionHandler::WriteMinidumpToDatabase(
252272 }
253273 }
254274
255- for (const auto & attachment : (* attachments_) ) {
275+ for (const auto & attachment : attachments_) {
256276 FileReader file_reader;
257277 if (!file_reader.Open (attachment)) {
258278 LOG (ERROR) << " attachment " << attachment.value ().c_str ()
0 commit comments