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

Side by Side Diff: client/crash_report_database_win.cc

Issue 987693004: Mac 10.6 SDK compatibility (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Define __STDC_FORMAT_MACROS Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « client/crash_report_database_test.cc ('k') | handler/mac/crash_report_upload_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 //! to kPending. 202 //! to kPending.
203 void AddNewRecord(const ReportDisk& new_report_disk); 203 void AddNewRecord(const ReportDisk& new_report_disk);
204 204
205 //! \brief Finds all reports in a given state. The \a reports vector is only 205 //! \brief Finds all reports in a given state. The \a reports vector is only
206 //! valid when CrashReportDatabase::kNoError is returned. 206 //! valid when CrashReportDatabase::kNoError is returned.
207 //! 207 //!
208 //! \param[in] desired_state The state to match. 208 //! \param[in] desired_state The state to match.
209 //! \param[out] reports Matching reports, must be empty on entry. 209 //! \param[out] reports Matching reports, must be empty on entry.
210 OperationStatus FindReports( 210 OperationStatus FindReports(
211 ReportState desired_state, 211 ReportState desired_state,
212 std::vector<const CrashReportDatabase::Report>* reports) const; 212 std::vector<CrashReportDatabase::Report>* reports) const;
213 213
214 //! \brief Finds the report matching the given UUID. 214 //! \brief Finds the report matching the given UUID.
215 //! 215 //!
216 //! The returned report is only valid if CrashReportDatabase::kNoError is 216 //! The returned report is only valid if CrashReportDatabase::kNoError is
217 //! returned. 217 //! returned.
218 //! 218 //!
219 //! \param[in] uuid The report identifier. 219 //! \param[in] uuid The report identifier.
220 //! \param[out] report_disk The found report, valid only if 220 //! \param[out] report_disk The found report, valid only if
221 //! CrashReportDatabase::kNoError is returned. Ownership is not 221 //! CrashReportDatabase::kNoError is returned. Ownership is not
222 //! transferred to the caller, and the report may not be modified. 222 //! transferred to the caller, and the report may not be modified.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 void Metadata::AddNewRecord(const ReportDisk& new_report_disk) { 309 void Metadata::AddNewRecord(const ReportDisk& new_report_disk) {
310 DCHECK(new_report_disk.state == ReportState::kPending); 310 DCHECK(new_report_disk.state == ReportState::kPending);
311 reports_.push_back(new_report_disk); 311 reports_.push_back(new_report_disk);
312 dirty_ = true; 312 dirty_ = true;
313 } 313 }
314 314
315 OperationStatus Metadata::FindReports( 315 OperationStatus Metadata::FindReports(
316 ReportState desired_state, 316 ReportState desired_state,
317 std::vector<const CrashReportDatabase::Report>* reports) const { 317 std::vector<CrashReportDatabase::Report>* reports) const {
318 DCHECK(reports->empty()); 318 DCHECK(reports->empty());
319 for (const auto& report : reports_) { 319 for (const auto& report : reports_) {
320 if (report.state == desired_state && 320 if (report.state == desired_state &&
321 VerifyReport(report, desired_state) == CrashReportDatabase::kNoError) { 321 VerifyReport(report, desired_state) == CrashReportDatabase::kNoError) {
322 reports->push_back(report); 322 reports->push_back(report);
323 } 323 }
324 } 324 }
325 return CrashReportDatabase::kNoError; 325 return CrashReportDatabase::kNoError;
326 } 326 }
327 327
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 ~CrashReportDatabaseWin() override; 522 ~CrashReportDatabaseWin() override;
523 523
524 bool Initialize(); 524 bool Initialize();
525 525
526 // CrashReportDatabase: 526 // CrashReportDatabase:
527 OperationStatus PrepareNewCrashReport(NewReport** report) override; 527 OperationStatus PrepareNewCrashReport(NewReport** report) override;
528 OperationStatus FinishedWritingCrashReport(NewReport* report, 528 OperationStatus FinishedWritingCrashReport(NewReport* report,
529 UUID* uuid) override; 529 UUID* uuid) override;
530 OperationStatus ErrorWritingCrashReport(NewReport* report) override; 530 OperationStatus ErrorWritingCrashReport(NewReport* report) override;
531 OperationStatus LookUpCrashReport(const UUID& uuid, Report* report) override; 531 OperationStatus LookUpCrashReport(const UUID& uuid, Report* report) override;
532 OperationStatus GetPendingReports( 532 OperationStatus GetPendingReports(std::vector<Report>* reports) override;
533 std::vector<const Report>* reports) override; 533 OperationStatus GetCompletedReports(std::vector<Report>* reports) override;
534 OperationStatus GetCompletedReports(
535 std::vector<const Report>* reports) override;
536 OperationStatus GetReportForUploading(const UUID& uuid, 534 OperationStatus GetReportForUploading(const UUID& uuid,
537 const Report** report) override; 535 const Report** report) override;
538 OperationStatus RecordUploadAttempt(const Report* report, 536 OperationStatus RecordUploadAttempt(const Report* report,
539 bool successful, 537 bool successful,
540 const std::string& id) override; 538 const std::string& id) override;
541 OperationStatus SkipReportUpload(const UUID& uuid) override; 539 OperationStatus SkipReportUpload(const UUID& uuid) override;
542 540
543 private: 541 private:
544 scoped_ptr<Metadata> AcquireMetadata(); 542 scoped_ptr<Metadata> AcquireMetadata();
545 543
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 return kDatabaseError; 633 return kDatabaseError;
636 // Find and return a copy of the matching report. 634 // Find and return a copy of the matching report.
637 const ReportDisk* report_disk; 635 const ReportDisk* report_disk;
638 OperationStatus os = metadata->FindSingleReport(uuid, &report_disk); 636 OperationStatus os = metadata->FindSingleReport(uuid, &report_disk);
639 if (os == kNoError) 637 if (os == kNoError)
640 *report = *report_disk; 638 *report = *report_disk;
641 return os; 639 return os;
642 } 640 }
643 641
644 OperationStatus CrashReportDatabaseWin::GetPendingReports( 642 OperationStatus CrashReportDatabaseWin::GetPendingReports(
645 std::vector<const Report>* reports) { 643 std::vector<Report>* reports) {
646 scoped_ptr<Metadata> metadata(AcquireMetadata()); 644 scoped_ptr<Metadata> metadata(AcquireMetadata());
647 return metadata ? metadata->FindReports(ReportState::kPending, reports) 645 return metadata ? metadata->FindReports(ReportState::kPending, reports)
648 : kDatabaseError; 646 : kDatabaseError;
649 } 647 }
650 648
651 OperationStatus CrashReportDatabaseWin::GetCompletedReports( 649 OperationStatus CrashReportDatabaseWin::GetCompletedReports(
652 std::vector<const Report>* reports) { 650 std::vector<Report>* reports) {
653 scoped_ptr<Metadata> metadata(AcquireMetadata()); 651 scoped_ptr<Metadata> metadata(AcquireMetadata());
654 return metadata ? metadata->FindReports(ReportState::kCompleted, reports) 652 return metadata ? metadata->FindReports(ReportState::kCompleted, reports)
655 : kDatabaseError; 653 : kDatabaseError;
656 } 654 }
657 655
658 OperationStatus CrashReportDatabaseWin::GetReportForUploading( 656 OperationStatus CrashReportDatabaseWin::GetReportForUploading(
659 const UUID& uuid, 657 const UUID& uuid,
660 const Report** report) { 658 const Report** report) {
661 scoped_ptr<Metadata> metadata(AcquireMetadata()); 659 scoped_ptr<Metadata> metadata(AcquireMetadata());
662 if (!metadata) 660 if (!metadata)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // static 726 // static
729 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( 727 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
730 const base::FilePath& path) { 728 const base::FilePath& path) {
731 scoped_ptr<CrashReportDatabaseWin> database_win( 729 scoped_ptr<CrashReportDatabaseWin> database_win(
732 new CrashReportDatabaseWin(path.Append(kDatabaseDirectoryName))); 730 new CrashReportDatabaseWin(path.Append(kDatabaseDirectoryName)));
733 return database_win->Initialize() ? database_win.Pass() 731 return database_win->Initialize() ? database_win.Pass()
734 : scoped_ptr<CrashReportDatabaseWin>(); 732 : scoped_ptr<CrashReportDatabaseWin>();
735 } 733 }
736 734
737 } // namespace crashpad 735 } // namespace crashpad
OLDNEW
« no previous file with comments | « client/crash_report_database_test.cc ('k') | handler/mac/crash_report_upload_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698