Chromium Code Reviews| Index: components/browser_watcher/postmortem_report_collector.h |
| diff --git a/components/browser_watcher/postmortem_report_collector.h b/components/browser_watcher/postmortem_report_collector.h |
| index 01871812eded07ee2d1ecf769721d0cdedd0850f..3e6287535ccc8b0cd884ec108ae00832e20636ab 100644 |
| --- a/components/browser_watcher/postmortem_report_collector.h |
| +++ b/components/browser_watcher/postmortem_report_collector.h |
| @@ -28,31 +28,40 @@ |
| namespace browser_watcher { |
| +// An interface to process postmortem stability files. |
| +class PostmortemProcessor { |
|
Sigurður Ásgeirsson
2017/06/05 15:39:39
I don't see that hoisting an interface here is hel
manzagop (departed)
2017/06/05 18:02:16
I initially thought there'd be a factory, but didn
|
| + public: |
| + virtual ~PostmortemProcessor() = default; |
| + |
| + virtual void Process(const std::vector<base::FilePath>& stability_files) = 0; |
| +}; |
| + |
| +class PostmortemDeleter : public PostmortemProcessor { |
| + public: |
| + PostmortemDeleter() = default; |
| + ~PostmortemDeleter() override = default; |
| + |
| + void Process(const std::vector<base::FilePath>& stability_files); |
| +}; |
| + |
| // Handles postmortem report collection by establishing the set of stability |
| // files to collect, then for each file: |
| // - extracting a report protocol buffer |
| // - registering a crash report with the crash database |
| // - writing a minidump file for the report |
| // TODO(manzagop): throttling, graceful handling of accumulating data. |
| -class PostmortemReportCollector { |
| +class PostmortemReportCollector : public PostmortemProcessor { |
| public: |
| PostmortemReportCollector(const std::string& product_name, |
| const std::string& version_number, |
| const std::string& channel_name, |
| + crashpad::CrashReportDatabase* report_database, |
| SystemSessionAnalyzer* analyzer); |
| - virtual ~PostmortemReportCollector(); |
| - |
| - // Collects postmortem stability reports from files found in |debug_info_dir|, |
| - // relying on |debug_file_pattern| and |excluded_debug_files|. Reports are |
| - // then wrapped in Crashpad reports, manufactured via |report_database|. |
| - // Returns the number crash reports successfully registered with the reporter. |
| - // TODO(manzagop): consider mechanisms for partial collection if this is to be |
| - // used on a critical path. |
| - int CollectAndSubmitAllPendingReports( |
| - const base::FilePath& debug_info_dir, |
| - const base::FilePath::StringType& debug_file_pattern, |
| - const std::set<base::FilePath>& excluded_debug_files, |
| - crashpad::CrashReportDatabase* report_database); |
| + ~PostmortemReportCollector() override; |
| + |
| + // Collects postmortem stability reports from |stability_files|. Reports are |
| + // then wrapped in Crashpad reports and registered with the crash database. |
| + void Process(const std::vector<base::FilePath>& stability_files); |
| const std::string& product_name() const { return product_name_; } |
| const std::string& version_number() const { return version_number_; } |
| @@ -81,18 +90,10 @@ class PostmortemReportCollector { |
| PostmortemReportCollectorCollectionFromGlobalTrackerTest, |
| SystemStateTest); |
| - // Virtual for unittesting. |
| - virtual std::vector<base::FilePath> GetDebugStateFilePaths( |
| - const base::FilePath& debug_info_dir, |
| - const base::FilePath::StringType& debug_file_pattern, |
| - const std::set<base::FilePath>& excluded_debug_files); |
| - |
| // Collects a stability file, generates a report and registers it with the |
| - // database. Returns true on success. False otherwise. |
| - bool CollectAndSubmitOneReport(const crashpad::UUID& client_id, |
| - const base::FilePath& file, |
| - crashpad::CrashReportDatabase* report_database, |
| - bool* system_unclean); |
| + // database. |
| + void CollectAndSubmitOneReport(const crashpad::UUID& client_id, |
| + const base::FilePath& file); |
| virtual CollectionStatus CollectOneReport( |
| const base::FilePath& stability_file, |
| @@ -111,6 +112,7 @@ class PostmortemReportCollector { |
| std::string version_number_; |
| std::string channel_name_; |
| + crashpad::CrashReportDatabase* report_database_; // Not owned. |
| SystemSessionAnalyzer* system_session_analyzer_; // Not owned. |
| DISALLOW_COPY_AND_ASSIGN(PostmortemReportCollector); |