Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11373)

Unified Diff: client/crash_report_database_mac.mm

Issue 904533002: Add CrashReportDatabase::ErrorWritingCrashReport() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/crash_report_database.h ('k') | client/crash_report_database_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crash_report_database_mac.mm
diff --git a/client/crash_report_database_mac.mm b/client/crash_report_database_mac.mm
index fe3e13a360a465531ac08d0182ff6532d0da32ec..1b54d1eff6ab174a622977e26c8fe8ec0ef978ba 100644
--- a/client/crash_report_database_mac.mm
+++ b/client/crash_report_database_mac.mm
@@ -109,6 +109,7 @@ class CrashReportDatabaseMac : public CrashReportDatabase {
OperationStatus PrepareNewCrashReport(NewReport** report) override;
OperationStatus FinishedWritingCrashReport(NewReport* report,
UUID* uuid) override;
+ OperationStatus ErrorWritingCrashReport(NewReport* report) override;
OperationStatus LookUpCrashReport(const UUID& uuid,
Report* report) override;
OperationStatus GetPendingReports(
@@ -280,6 +281,24 @@ CrashReportDatabaseMac::FinishedWritingCrashReport(NewReport* report,
}
CrashReportDatabase::OperationStatus
+CrashReportDatabaseMac::ErrorWritingCrashReport(NewReport* report) {
+ // Takes ownership of the |handle| and the O_EXLOCK.
+ base::ScopedFD lock(report->handle);
+
+ // Take ownership of the report.
+ scoped_ptr<NewReport> scoped_report(report);
+
+ // Remove the file that the report would have been written to had no error
+ // occurred.
+ if (unlink(report->path.value().c_str()) != 0) {
+ PLOG(ERROR) << "unlink " << report->path.value();
+ return kFileSystemError;
+ }
+
+ return kNoError;
+}
+
+CrashReportDatabase::OperationStatus
CrashReportDatabaseMac::LookUpCrashReport(const UUID& uuid,
CrashReportDatabase::Report* report) {
base::FilePath path = LocateCrashReport(uuid);
« no previous file with comments | « client/crash_report_database.h ('k') | client/crash_report_database_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698