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

Side by Side Diff: chrome/browser/crash_upload_list_crashpad.cc

Issue 1481703002: win: Move Crashpad all into chrome.exe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: breakpad_dump_location, revert test change Created 5 years 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 unified diff | Download patch
OLDNEW
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_crashpad.h" 5 #include "chrome/browser/crash_upload_list_crashpad.h"
6 6
7 #include "base/threading/sequenced_worker_pool.h" 7 #include "base/threading/sequenced_worker_pool.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "chrome/common/chrome_constants.h"
9 #include "components/crash/content/app/crashpad.h" 10 #include "components/crash/content/app/crashpad.h"
10 11
12 namespace {
13
14 #if defined(OS_WIN)
15 typedef void (*GetUploadedReportsPointer)(
16 const crash_reporter::UploadedReport** reports,
17 size_t* report_count);
18
19 void GetUploadedReportsThunk(
20 std::vector<crash_reporter::UploadedReport>* uploaded_reports) {
21 static GetUploadedReportsPointer get_uploaded_reports = nullptr;
Mark Mentovai 2015/12/02 22:47:12 Can you do the static GetUploadedReportsPointer x
scottmg 2015/12/03 01:40:15 Done.
22 if (!get_uploaded_reports) {
23 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
24 if (!exe_module)
25 return;
26 get_uploaded_reports = reinterpret_cast<GetUploadedReportsPointer>(
27 GetProcAddress(exe_module, "GetUploadedReportsImpl"));
28 }
29
30 if (get_uploaded_reports) {
31 const crash_reporter::UploadedReport* reports;
32 size_t report_count;
33 get_uploaded_reports(&reports, &report_count);
34 *uploaded_reports = std::vector<crash_reporter::UploadedReport>(
35 reports, reports + report_count);
36 }
37 }
38 #endif // OS_WIN
39
40 } // namespace
41
11 CrashUploadListCrashpad::CrashUploadListCrashpad( 42 CrashUploadListCrashpad::CrashUploadListCrashpad(
12 Delegate* delegate, 43 Delegate* delegate,
13 const base::FilePath& upload_log_path,
14 const scoped_refptr<base::SequencedWorkerPool>& worker_pool) 44 const scoped_refptr<base::SequencedWorkerPool>& worker_pool)
15 : CrashUploadList(delegate, upload_log_path, worker_pool) {} 45 : CrashUploadList(delegate, base::FilePath(), worker_pool) {}
16 46
17 CrashUploadListCrashpad::~CrashUploadListCrashpad() {} 47 CrashUploadListCrashpad::~CrashUploadListCrashpad() {}
18 48
19 void CrashUploadListCrashpad::LoadUploadList() { 49 void CrashUploadListCrashpad::LoadUploadList() {
20 std::vector<crash_reporter::UploadedReport> uploaded_reports; 50 std::vector<crash_reporter::UploadedReport> uploaded_reports;
51 #if defined(OS_WIN)
52 // On Windows, we only link crash client into chrome.exe (not the dlls), and
53 // it does the registration. That means the global that holds the crash report
54 // database lives in the .exe, so we need to grab a pointer to a helper in the
55 // exe to get our uploaded reports list.
56 GetUploadedReportsThunk(&uploaded_reports);
57 #else
21 crash_reporter::GetUploadedReports(&uploaded_reports); 58 crash_reporter::GetUploadedReports(&uploaded_reports);
59 #endif
22 60
23 ClearUploads(); 61 ClearUploads();
24 for (const crash_reporter::UploadedReport& uploaded_report : 62 for (const crash_reporter::UploadedReport& uploaded_report :
25 uploaded_reports) { 63 uploaded_reports) {
26 AppendUploadInfo( 64 AppendUploadInfo(
27 UploadInfo(uploaded_report.remote_id, 65 UploadInfo(uploaded_report.remote_id,
28 base::Time::FromTimeT(uploaded_report.creation_time), 66 base::Time::FromTimeT(uploaded_report.creation_time),
29 uploaded_report.local_id, base::Time())); 67 uploaded_report.local_id, base::Time()));
30 } 68 }
31 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698