| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "components/crash/content/app/fallback_crash_handler_win.h" | 5 #include "components/crash/content/app/fallback_crash_handler_win.h" |
| 6 | 6 |
| 7 #include <dbghelp.h> | 7 #include <dbghelp.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/macros.h" |
| 16 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
| 17 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 20 #include "base/win/win_util.h" | 21 #include "base/win/win_util.h" |
| 21 #include "third_party/crashpad/crashpad/client/crash_report_database.h" | 22 #include "third_party/crashpad/crashpad/client/crash_report_database.h" |
| 22 #include "third_party/crashpad/crashpad/client/settings.h" | 23 #include "third_party/crashpad/crashpad/client/settings.h" |
| 23 #include "third_party/crashpad/crashpad/minidump/minidump_extensions.h" | 24 #include "third_party/crashpad/crashpad/minidump/minidump_extensions.h" |
| 24 | 25 |
| 25 namespace crash_reporter { | 26 namespace crash_reporter { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 // Writes |data_len| bytes from |data| to the file at the current location. | 51 // Writes |data_len| bytes from |data| to the file at the current location. |
| 51 bool WriteData(const void* data, size_t data_len); | 52 bool WriteData(const void* data, size_t data_len); |
| 52 bool WriteAndAdvance(const void* data, | 53 bool WriteAndAdvance(const void* data, |
| 53 size_t data_len, | 54 size_t data_len, |
| 54 FilePosition* position); | 55 FilePosition* position); |
| 55 | 56 |
| 56 base::File* file_; | 57 base::File* file_; |
| 57 std::vector<MINIDUMP_DIRECTORY> directory_; | 58 std::vector<MINIDUMP_DIRECTORY> directory_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(MinidumpUpdater); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 MinidumpUpdater::MinidumpUpdater() : file_(nullptr) {} | 63 MinidumpUpdater::MinidumpUpdater() : file_(nullptr) {} |
| 61 | 64 |
| 62 bool MinidumpUpdater::Initialize(base::File* file) { | 65 bool MinidumpUpdater::Initialize(base::File* file) { |
| 63 DCHECK(file && file->IsValid()); | 66 DCHECK(file && file->IsValid()); |
| 64 DCHECK(!file_); | 67 DCHECK(!file_); |
| 65 | 68 |
| 66 // Read the file header. | 69 // Read the file header. |
| 67 MINIDUMP_HEADER header = {}; | 70 MINIDUMP_HEADER header = {}; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 443 |
| 441 crashpad::UUID report_id = {}; | 444 crashpad::UUID report_id = {}; |
| 442 status = database->FinishedWritingCrashReport(report, &report_id); | 445 status = database->FinishedWritingCrashReport(report, &report_id); |
| 443 if (status != crashpad::CrashReportDatabase::kNoError) | 446 if (status != crashpad::CrashReportDatabase::kNoError) |
| 444 return false; | 447 return false; |
| 445 | 448 |
| 446 return true; | 449 return true; |
| 447 } | 450 } |
| 448 | 451 |
| 449 } // namespace crash_reporter | 452 } // namespace crash_reporter |
| OLD | NEW |