OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/crash_upload_list/crash_upload_list_crashpad.h" | 5 #include "chrome/browser/crash_upload_list/crash_upload_list_crashpad.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 }(); | 31 }(); |
32 | 32 |
33 if (get_crash_reports) { | 33 if (get_crash_reports) { |
34 const crash_reporter::Report* reports_pointer; | 34 const crash_reporter::Report* reports_pointer; |
35 size_t report_count; | 35 size_t report_count; |
36 get_crash_reports(&reports_pointer, &report_count); | 36 get_crash_reports(&reports_pointer, &report_count); |
37 *reports = std::vector<crash_reporter::Report>( | 37 *reports = std::vector<crash_reporter::Report>( |
38 reports_pointer, reports_pointer + report_count); | 38 reports_pointer, reports_pointer + report_count); |
39 } | 39 } |
40 } | 40 } |
41 | |
42 void RequestSingleCrashUploadThunk(const std::string& local_id) { | |
43 // The crash reporting is handled by chrome_elf.dll which loads early in | |
44 // the chrome process. | |
45 HMODULE elf_module = GetModuleHandle(chrome::kChromeElfDllName); | |
46 if (elf_module) { | |
47 static RequestSingleCrashUploadPointer request_single_crash_upload = | |
48 reinterpret_cast<RequestSingleCrashUploadPointer>( | |
49 GetProcAddress(elf_module, "RequestSingleCrashUploadImpl")); | |
jwd
2016/08/23 19:14:30
Can you pull the string out into a constant in the
gayane -on leave until 09-2017
2016/08/23 20:57:45
Done.
| |
50 | |
51 if (request_single_crash_upload) | |
52 request_single_crash_upload(local_id); | |
53 } | |
54 } | |
55 | |
41 #endif // OS_WIN | 56 #endif // OS_WIN |
42 | 57 |
43 UploadList::UploadInfo::State ReportUploadStateToUploadInfoState( | 58 UploadList::UploadInfo::State ReportUploadStateToUploadInfoState( |
44 crash_reporter::ReportUploadState state) { | 59 crash_reporter::ReportUploadState state) { |
45 switch (state) { | 60 switch (state) { |
46 case crash_reporter::ReportUploadState::NotUploaded: | 61 case crash_reporter::ReportUploadState::NotUploaded: |
47 return UploadList::UploadInfo::State::NotUploaded; | 62 return UploadList::UploadInfo::State::NotUploaded; |
48 | 63 |
49 case crash_reporter::ReportUploadState::Pending: | 64 case crash_reporter::ReportUploadState::Pending: |
50 return UploadList::UploadInfo::State::Pending; | 65 return UploadList::UploadInfo::State::Pending; |
51 | 66 |
52 case crash_reporter::ReportUploadState::Uploaded: | 67 case crash_reporter::ReportUploadState::Uploaded: |
53 return UploadList::UploadInfo::State::Uploaded; | 68 return UploadList::UploadInfo::State::Uploaded; |
69 | |
70 case crash_reporter::ReportUploadState::UserRequested: | |
71 return UploadList::UploadInfo::State::UserRequested; | |
54 } | 72 } |
55 | 73 |
56 NOTREACHED(); | 74 NOTREACHED(); |
57 return UploadList::UploadInfo::State::Uploaded; | 75 return UploadList::UploadInfo::State::Uploaded; |
58 } | 76 } |
59 | 77 |
60 } // namespace | 78 } // namespace |
61 | 79 |
62 CrashUploadListCrashpad::CrashUploadListCrashpad( | 80 CrashUploadListCrashpad::CrashUploadListCrashpad( |
63 Delegate* delegate, | 81 Delegate* delegate, |
(...skipping 15 matching lines...) Expand all Loading... | |
79 crash_reporter::GetReports(&reports); | 97 crash_reporter::GetReports(&reports); |
80 #endif | 98 #endif |
81 | 99 |
82 for (const crash_reporter::Report& report : reports) { | 100 for (const crash_reporter::Report& report : reports) { |
83 uploads->push_back( | 101 uploads->push_back( |
84 UploadInfo(report.remote_id, base::Time::FromTimeT(report.upload_time), | 102 UploadInfo(report.remote_id, base::Time::FromTimeT(report.upload_time), |
85 report.local_id, base::Time::FromTimeT(report.capture_time), | 103 report.local_id, base::Time::FromTimeT(report.capture_time), |
86 ReportUploadStateToUploadInfoState(report.state))); | 104 ReportUploadStateToUploadInfoState(report.state))); |
87 } | 105 } |
88 } | 106 } |
107 | |
108 void CrashUploadListCrashpad::RequestSingleCrashUpload( | |
109 const std::string& local_id) { | |
110 #if defined(OS_WIN) | |
111 // On Windows, we only link crash client into chrome.exe (not the dlls), and | |
112 // it does the registration. That means the global that holds the crash report | |
113 // database lives in the .exe, so we need to grab a pointer to a helper in the | |
114 // exe. | |
jwd
2016/08/23 19:14:30
I don't think this is a good way of explaining it.
gayane -on leave until 09-2017
2016/08/23 20:57:45
Done.
| |
115 RequestSingleCrashUploadThunk(local_id); | |
116 #else | |
117 crash_reporter::RequestSingleCrashUpload(local_id); | |
118 #endif | |
119 } | |
OLD | NEW |