| 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 #ifndef COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ | 5 #ifndef COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ |
| 6 #define COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ | 6 #define COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "components/browser_watcher/stability_report.pb.h" | 13 #include "components/browser_watcher/stability_report.pb.h" |
| 14 #include "third_party/crashpad/crashpad/util/misc/uuid.h" | 14 #include "third_party/crashpad/crashpad/util/misc/uuid.h" |
| 15 | 15 |
| 16 namespace browser_watcher { | 16 namespace browser_watcher { |
| 17 | 17 |
| 18 // Minidump information required by the Crashpad reporter. | |
| 19 struct MinidumpInfo { | |
| 20 MinidumpInfo(); | |
| 21 ~MinidumpInfo(); | |
| 22 | |
| 23 // Client and report identifiers, from the Crashpad database. | |
| 24 crashpad::UUID client_id; | |
| 25 crashpad::UUID report_id; | |
| 26 | |
| 27 // Product name, version number and channel name from the executable's version | |
| 28 // resource. | |
| 29 std::string product_name; | |
| 30 std::string version_number; | |
| 31 std::string channel_name; | |
| 32 | |
| 33 // The platform identifier (e.g. "Win32" or "Win64"). | |
| 34 std::string platform; | |
| 35 }; | |
| 36 | |
| 37 // Write to |minidump_file| a minimal minidump that wraps |report|. Returns | 18 // Write to |minidump_file| a minimal minidump that wraps |report|. Returns |
| 38 // true on success, false otherwise. | 19 // true on success, false otherwise. |
| 39 // Note: the caller owns |minidump_file| and is responsible for keeping it valid | 20 // Note: the caller owns |minidump_file| and is responsible for keeping it valid |
| 40 // for this function's duration. |minidump_file| is expected to be empty | 21 // for this function's duration. |minidump_file| is expected to be empty |
| 41 // and a binary stream. | 22 // and a binary stream. |
| 42 bool WritePostmortemDump(base::PlatformFile minidump_file, | 23 bool WritePostmortemDump(base::PlatformFile minidump_file, |
| 43 const StabilityReport& report, | 24 const crashpad::UUID& client_id, |
| 44 const MinidumpInfo& minidump_info); | 25 const crashpad::UUID& report_id, |
| 26 StabilityReport* report); |
| 45 | 27 |
| 46 } // namespace browser_watcher | 28 } // namespace browser_watcher |
| 47 | 29 |
| 48 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ | 30 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ |
| OLD | NEW |