| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Following an unclean shutdown, a stability report can be collected and | 5 // Following an unclean shutdown, a stability report can be collected and |
| 6 // submitted for upload to a reporter. | 6 // submitted for upload to a reporter. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ | 8 #ifndef COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ |
| 9 #define COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ | 9 #define COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ |
| 10 | 10 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <set> | 14 #include <set> |
| 15 #include <string> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "base/files/file.h" | 18 #include "base/files/file.h" |
| 18 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 19 #include "base/gtest_prod_util.h" | 20 #include "base/gtest_prod_util.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "components/browser_watcher/stability_report.pb.h" | 22 #include "components/browser_watcher/stability_report.pb.h" |
| 22 #include "third_party/crashpad/crashpad/client/crash_report_database.h" | 23 #include "third_party/crashpad/crashpad/client/crash_report_database.h" |
| 23 | 24 |
| 24 namespace browser_watcher { | 25 namespace browser_watcher { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 // then wrapped in Crashpad reports, manufactured via |report_database|. | 50 // then wrapped in Crashpad reports, manufactured via |report_database|. |
| 50 // Returns the number crash reports successfully registered with the reporter. | 51 // Returns the number crash reports successfully registered with the reporter. |
| 51 // TODO(manzagop): consider mechanisms for partial collection if this is to be | 52 // TODO(manzagop): consider mechanisms for partial collection if this is to be |
| 52 // used on a critical path. | 53 // used on a critical path. |
| 53 int CollectAndSubmitForUpload( | 54 int CollectAndSubmitForUpload( |
| 54 const base::FilePath& debug_info_dir, | 55 const base::FilePath& debug_info_dir, |
| 55 const base::FilePath::StringType& debug_file_pattern, | 56 const base::FilePath::StringType& debug_file_pattern, |
| 56 const std::set<base::FilePath>& excluded_debug_files, | 57 const std::set<base::FilePath>& excluded_debug_files, |
| 57 crashpad::CrashReportDatabase* report_database); | 58 crashpad::CrashReportDatabase* report_database); |
| 58 | 59 |
| 60 virtual const std::string& GetProductName() = 0; |
| 61 virtual const std::string& GetProductVersion() = 0; |
| 62 virtual const std::string& GetProductChannel() = 0; |
| 63 |
| 59 private: | 64 private: |
| 60 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, | 65 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, |
| 61 GetDebugStateFilePaths); | 66 GetDebugStateFilePaths); |
| 62 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, CollectEmptyFile); | 67 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, CollectEmptyFile); |
| 63 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, CollectRandomFile); | 68 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorTest, CollectRandomFile); |
| 64 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorCollectionTest, | 69 FRIEND_TEST_ALL_PREFIXES(PostmortemReportCollectorCollectionTest, |
| 65 CollectSuccess); | 70 CollectSuccess); |
| 66 | 71 |
| 67 // Virtual for unittesting. | 72 // Virtual for unittesting. |
| 68 virtual std::vector<base::FilePath> GetDebugStateFilePaths( | 73 virtual std::vector<base::FilePath> GetDebugStateFilePaths( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 const crashpad::UUID& client_id, | 89 const crashpad::UUID& client_id, |
| 85 const crashpad::UUID& report_id, | 90 const crashpad::UUID& report_id, |
| 86 base::PlatformFile minidump_file); | 91 base::PlatformFile minidump_file); |
| 87 | 92 |
| 88 DISALLOW_COPY_AND_ASSIGN(PostmortemReportCollector); | 93 DISALLOW_COPY_AND_ASSIGN(PostmortemReportCollector); |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 } // namespace browser_watcher | 96 } // namespace browser_watcher |
| 92 | 97 |
| 93 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ | 98 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_REPORT_COLLECTOR_H_ |
| OLD | NEW |