|
| CrashReportDatabaseGeneric (const CrashReportDatabaseGeneric &)=delete |
|
CrashReportDatabaseGeneric & | operator= (const CrashReportDatabaseGeneric &)=delete |
|
bool | Initialize (const base::FilePath &path, bool may_create) |
|
Settings * | GetSettings () override |
| Returns the Settings object for this database.
|
|
OperationStatus | PrepareNewCrashReport (std::unique_ptr< NewReport > *report) override |
| Creates a record of a new crash report.
|
|
OperationStatus | FinishedWritingCrashReport (std::unique_ptr< NewReport > report, UUID *uuid) override |
| Informs the database that a crash report has been successfully written.
|
|
OperationStatus | LookUpCrashReport (const UUID &uuid, Report *report) override |
| Returns the crash report record for the unique identifier.
|
|
OperationStatus | GetPendingReports (std::vector< Report > *reports) override |
| Returns a list of crash report records that have not been uploaded.
|
|
OperationStatus | GetCompletedReports (std::vector< Report > *reports) override |
| Returns a list of crash report records that have been completed, either by being uploaded or by skipping upload.
|
|
OperationStatus | GetReportForUploading (const UUID &uuid, std::unique_ptr< const UploadReport > *report, bool report_metrics) override |
| Obtains and locks a report object for uploading to a collection server. On iOS the file lock is released and mutual-exclusion is kept via a file attribute.
|
|
OperationStatus | SkipReportUpload (const UUID &uuid, Metrics::CrashSkippedReason reason) override |
| Moves a report from the pending state to the completed state, but without the report being uploaded.
|
|
OperationStatus | DeleteReport (const UUID &uuid) override |
| Deletes a crash report file and its associated metadata.
|
|
OperationStatus | RequestUpload (const UUID &uuid) override |
| Marks a crash report as explicitly requested to be uploaded by the user and moves it to 'pending' state.
|
|
int | CleanDatabase (time_t lockfile_ttl) override |
| Cleans the database of expired lockfiles, metadata without report files, report files without metadata, and attachments without report files.
|
|
base::FilePath | DatabasePath () override |
| The path to the database passed to Initialize.
|
|
| CrashReportDatabase (const CrashReportDatabase &)=delete |
|
CrashReportDatabase & | operator= (const CrashReportDatabase &)=delete |
|
OperationStatus | RecordUploadComplete (std::unique_ptr< const UploadReport > report, const std::string &id) |
| Records a successful upload for a report and updates the last upload attempt time as returned by Settings::GetLastUploadAttemptTime().
|
|
int crashpad::CrashReportDatabaseGeneric::CleanDatabase |
( |
time_t | lockfile_ttl | ) |
|
|
overridevirtual |
Cleans the database of expired lockfiles, metadata without report files, report files without metadata, and attachments without report files.
As the macOS implementation does not use lock or metadata files, the cleaning is limited to attachments without report files.
- Parameters
-
[in] | lockfile_ttl | The number of seconds at which lockfiles or new report files are considered expired. |
- Returns
- The number of reports cleaned.
Reimplemented from crashpad::CrashReportDatabase.
OperationStatus crashpad::CrashReportDatabaseGeneric::GetReportForUploading |
( |
const UUID & | uuid, |
|
|
std::unique_ptr< const UploadReport > * | report, |
|
|
bool | report_metrics ) |
|
overridevirtual |
Obtains and locks a report object for uploading to a collection server. On iOS the file lock is released and mutual-exclusion is kept via a file attribute.
Callers should upload the crash report using the FileReader provided. Callers should then call RecordUploadComplete() to record a successful upload. If RecordUploadComplete() is not called, the upload attempt will be recorded as unsuccessful and the report lock released when report is destroyed.
On iOS, holding a lock during a slow upload can lead to watchdog kills if the app is suspended mid-upload. Instead, if the client can obtain the lock, the database sets a lock-time file attribute and releases the lock. The attribute is cleared when the upload is completed. The lock-time attribute can be used to prevent file access from other processes, or to discard reports that likely were terminated mid-upload.
- Parameters
-
[in] | uuid | The unique identifier for the crash report record. |
[out] | report | A crash report record for the report to be uploaded. Only valid if this returns kNoError. |
[in] | report_metrics | If false , metrics will not be recorded for this upload attempt when RecordUploadComplete() is called or report is destroyed. Metadata for the upload attempt will still be recorded in the database. |
- Returns
- The operation status code.
Implements crashpad::CrashReportDatabase.