| 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 // Note: aside from using windows headers to obtain the definitions of minidump | 5 // Note: aside from using windows headers to obtain the definitions of minidump |
| 6 // structures, nothing here is windows specific. This seems like the best | 6 // structures, nothing here is windows specific. This seems like the best |
| 7 // approach given this code is for temporary experimentation on Windows. | 7 // approach given this code is for temporary experimentation on Windows. |
| 8 // Longer term, Crashpad will take over the minidump writing in this case as | 8 // Longer term, Crashpad will take over the minidump writing in this case as |
| 9 // well. | 9 // well. |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // The directory entry for the stability report's stream. | 190 // The directory entry for the stability report's stream. |
| 191 RegisterDirectoryEntry(kStabilityReportStreamType, report_pos, | 191 RegisterDirectoryEntry(kStabilityReportStreamType, report_pos, |
| 192 serialized_report.length()); | 192 serialized_report.length()); |
| 193 | 193 |
| 194 // Write mandatory crash keys. These will be read by crashpad and used as | 194 // Write mandatory crash keys. These will be read by crashpad and used as |
| 195 // http request parameters for the upload. Keys and values should match | 195 // http request parameters for the upload. Keys and values should match |
| 196 // server side configuration. | 196 // server side configuration. |
| 197 // TODO(manzagop): use product and version from the stability report. The | 197 // TODO(manzagop): use product and version from the stability report. The |
| 198 // current executable's values are an (imperfect) proxy. | 198 // current executable's values are an (imperfect) proxy. |
| 199 std::map<std::string, std::string> crash_keys = { | 199 std::map<std::string, std::string> crash_keys = { |
| 200 {"product", minidump_info.product_name + "_Postmortem"}, | 200 {"prod", minidump_info.product_name + "_Postmortem"}, |
| 201 {"version", minidump_info.version_number}}; | 201 {"ver", minidump_info.version_number}, |
| 202 {"channel", minidump_info.channel_name}, |
| 203 {"plat", minidump_info.platform}}; |
| 202 if (!AppendCrashpadInfo(minidump_info.client_id, minidump_info.report_id, | 204 if (!AppendCrashpadInfo(minidump_info.client_id, minidump_info.report_id, |
| 203 crash_keys)) | 205 crash_keys)) |
| 204 return false; | 206 return false; |
| 205 | 207 |
| 206 // Write the directory. | 208 // Write the directory. |
| 207 FilePosition directory_pos = 0U; | 209 FilePosition directory_pos = 0U; |
| 208 if (!AppendVec(directory_, &directory_pos)) | 210 if (!AppendVec(directory_, &directory_pos)) |
| 209 return false; | 211 return false; |
| 210 | 212 |
| 211 // Write the header. | 213 // Write the header. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 uint32_t size) { | 398 uint32_t size) { |
| 397 MINIDUMP_DIRECTORY entry = {0}; | 399 MINIDUMP_DIRECTORY entry = {0}; |
| 398 entry.StreamType = stream_type; | 400 entry.StreamType = stream_type; |
| 399 entry.Location.Rva = pos; | 401 entry.Location.Rva = pos; |
| 400 entry.Location.DataSize = size; | 402 entry.Location.DataSize = size; |
| 401 directory_.push_back(entry); | 403 directory_.push_back(entry); |
| 402 } | 404 } |
| 403 | 405 |
| 404 } // namespace | 406 } // namespace |
| 405 | 407 |
| 408 MinidumpInfo::MinidumpInfo() {} |
| 409 |
| 410 MinidumpInfo::~MinidumpInfo() {} |
| 411 |
| 406 bool WritePostmortemDump(base::PlatformFile minidump_file, | 412 bool WritePostmortemDump(base::PlatformFile minidump_file, |
| 407 const StabilityReport& report, | 413 const StabilityReport& report, |
| 408 const MinidumpInfo& minidump_info) { | 414 const MinidumpInfo& minidump_info) { |
| 409 PostmortemMinidumpWriter writer; | 415 PostmortemMinidumpWriter writer; |
| 410 return writer.WriteDump(minidump_file, report, minidump_info); | 416 return writer.WriteDump(minidump_file, report, minidump_info); |
| 411 } | 417 } |
| 412 | 418 |
| 413 } // namespace browser_watcher | 419 } // namespace browser_watcher |
| OLD | NEW |