Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc

Issue 2268783002: Manual crash uploads for mac and win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: policy restrictions + show crashes when crash uploads disabled Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc
diff --git a/chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc b/chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc
index d62973e34209172aa68e34df6a592eef45623a25..87ad299245efc63d363b5cdd011c9c0377052704 100644
--- a/chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc
+++ b/chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc
@@ -15,6 +15,10 @@
namespace {
#if defined(OS_WIN)
+// The name of the function used for requesting a single crash upload from
+// components/crash/content/app/crashpad.cc. Called through chrome_elf dll.
+const char kRequestSingleCrashUploadFunc[] = "RequestSingleCrashUploadImpl";
+
typedef void (*GetCrashReportsPointer)(
const crash_reporter::Report** reports,
size_t* report_count);
@@ -38,6 +42,21 @@ void GetReportsThunk(
reports_pointer, reports_pointer + report_count);
}
}
+
+void RequestSingleCrashUploadThunk(const std::string& local_id) {
Mark Mentovai 2016/08/25 20:25:11 This whole function should probably just follow th
gayane -on leave until 09-2017 2016/08/26 00:12:54 Done.
+ // The crash reporting is handled by chrome_elf.dll which loads early in
+ // the chrome process.
+ HMODULE elf_module = GetModuleHandle(chrome::kChromeElfDllName);
+ if (elf_module) {
+ static RequestSingleCrashUploadPointer request_single_crash_upload =
Mark Mentovai 2016/08/25 20:25:11 This type wasn’t ever declared.
gayane -on leave until 09-2017 2016/08/26 00:12:54 Done.
+ reinterpret_cast<RequestSingleCrashUploadPointer>(
+ GetProcAddress(elf_module, kRequestSingleCrashUploadFunc);
Mark Mentovai 2016/08/25 20:25:11 No reason for this to be a constant as opposed to
gayane -on leave until 09-2017 2016/08/26 00:12:54 Done.
+
+ if (request_single_crash_upload)
+ request_single_crash_upload(local_id);
+ }
+}
+
#endif // OS_WIN
UploadList::UploadInfo::State ReportUploadStateToUploadInfoState(
@@ -51,6 +70,9 @@ UploadList::UploadInfo::State ReportUploadStateToUploadInfoState(
case crash_reporter::ReportUploadState::Uploaded:
return UploadList::UploadInfo::State::Uploaded;
+
+ case crash_reporter::ReportUploadState::UserRequested:
+ return UploadList::UploadInfo::State::UserRequested;
}
NOTREACHED();
@@ -86,3 +108,14 @@ void CrashUploadListCrashpad::LoadUploadList(
ReportUploadStateToUploadInfoState(report.state)));
}
}
+
+void CrashUploadListCrashpad::RequestSingleCrashUpload(
+ const std::string& local_id) {
+#if defined(OS_WIN)
+ // On Windows, crash reporting is handled by chrome_elf.dll, thats why we
+ // can't call crash_reporter::RequestSingleCrashUpload directly.
+ RequestSingleCrashUploadThunk(local_id);
+#else
+ crash_reporter::RequestSingleCrashUpload(local_id);
+#endif
+}

Powered by Google App Engine
This is Rietveld 408576698