Chromium Code Reviews| 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..e40775f76eaa330382b202659c8d01e6f7418cbc 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,27 @@ 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; |
| + |
| + lock.reset(); |
|
Mark Mentovai
2015/10/07 03:54:27
What’s the thinking behind releasing the lock *bef
Robert Sesek
2015/10/07 16:24:34
I didn't expect to be able to unlink() with an flo
Mark Mentovai
2015/10/07 16:40:13
Robert Sesek wrote:
|
| + 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) { |