Index: client/crash_report_database_mac.mm |
diff --git a/client/crash_report_database_mac.mm b/client/crash_report_database_mac.mm |
index f451efb0e0d96a3d14eaf48d2ffdc02bfd77f66a..621d8a66f344184be23522be35975c6412d8a093 100644 |
--- a/client/crash_report_database_mac.mm |
+++ b/client/crash_report_database_mac.mm |
@@ -125,6 +125,7 @@ class CrashReportDatabaseMac : public CrashReportDatabase { |
bool successful, |
const std::string& id) override; |
OperationStatus SkipReportUpload(const UUID& uuid) override; |
+ OperationStatus DeleteReport(const UUID& uuid) override; |
private: |
//! \brief A private extension of the Report class that maintains bookkeeping |
@@ -476,6 +477,26 @@ CrashReportDatabase::OperationStatus CrashReportDatabaseMac::SkipReportUpload( |
return kNoError; |
} |
+CrashReportDatabase::OperationStatus CrashReportDatabaseMac::DeleteReport( |
+ const UUID& uuid) { |
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
+ |
+ base::FilePath report_path = LocateCrashReport(uuid); |
+ if (report_path.empty()) |
+ return kReportNotFound; |
+ |
+ base::ScopedFD lock(ObtainReportLock(report_path)); |
+ if (!lock.is_valid()) |
+ return kBusyError; |
+ |
+ if (unlink(report_path.value().c_str()) != 0) { |
+ PLOG(ERROR) << "unlink " << report_path.value(); |
+ return kFileSystemError; |
+ } |
+ |
+ return kNoError; |
+} |
+ |
base::FilePath CrashReportDatabaseMac::LocateCrashReport(const UUID& uuid) { |
const std::string target_uuid = uuid.ToString(); |
for (size_t i = 0; i < arraysize(kReportDirectories); ++i) { |