| 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. | 18 // Minidump information required by the Crashpad reporter. |
| 19 struct MinidumpInfo { | 19 struct MinidumpInfo { |
| 20 crashpad::UUID client_id; // The client's identifier. | 20 MinidumpInfo(); |
| 21 crashpad::UUID report_id; // The report's identifier. | 21 ~MinidumpInfo(); |
| 22 std::string product_name; // The product name to be used by the reporter. | 22 |
| 23 std::string version_number; // The product's version number. | 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; |
| 24 }; | 35 }; |
| 25 | 36 |
| 26 // Write to |minidump_file| a minimal minidump that wraps |report|. Returns | 37 // Write to |minidump_file| a minimal minidump that wraps |report|. Returns |
| 27 // true on success, false otherwise. | 38 // true on success, false otherwise. |
| 28 // Note: the caller owns |minidump_file| and is responsible for keeping it valid | 39 // Note: the caller owns |minidump_file| and is responsible for keeping it valid |
| 29 // for this function's duration. |minidump_file| is expected to be empty | 40 // for this function's duration. |minidump_file| is expected to be empty |
| 30 // and a binary stream. | 41 // and a binary stream. |
| 31 bool WritePostmortemDump(base::PlatformFile minidump_file, | 42 bool WritePostmortemDump(base::PlatformFile minidump_file, |
| 32 const StabilityReport& report, | 43 const StabilityReport& report, |
| 33 const MinidumpInfo& minidump_info); | 44 const MinidumpInfo& minidump_info); |
| 34 | 45 |
| 35 } // namespace browser_watcher | 46 } // namespace browser_watcher |
| 36 | 47 |
| 37 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ | 48 #endif // COMPONENTS_BROWSER_WATCHER_POSTMORTEM_MINIDUMP_WRITER_H_ |
| OLD | NEW |