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

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: rebase 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 std::vector<crash_reporter::UploadedReport>*);
17
18 void GetUploadedReportsThunk(
Mark Mentovai 2015/12/02 03:05:07 :/
scottmg 2015/12/02 05:35:00 Yeah, it's icky. But not unprecedented as I learne
19 std::vector<crash_reporter::UploadedReport>* uploaded_reports) {
20 static GetUploadedReportsPointer get_uploaded_reports = nullptr;
Mark Mentovai 2015/12/02 03:05:07 Too bad we don’t have GET_FUNCTION() here.
scottmg 2015/12/02 05:35:00 Yeah, we should probably add that to base.
21 if (!get_uploaded_reports) {
22 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
23 if (!exe_module)
24 return;
25 get_uploaded_reports = reinterpret_cast<GetUploadedReportsPointer>(
26 GetProcAddress(exe_module, "GetUploadedReportsImpl"));
27 }
28
29 if (get_uploaded_reports)
30 get_uploaded_reports(uploaded_reports);
31 }
32 #endif // OS_WIN
33
34 } // namespace
35
11 CrashUploadListCrashpad::CrashUploadListCrashpad( 36 CrashUploadListCrashpad::CrashUploadListCrashpad(
12 Delegate* delegate, 37 Delegate* delegate,
13 const base::FilePath& upload_log_path, 38 const base::FilePath& upload_log_path,
14 const scoped_refptr<base::SequencedWorkerPool>& worker_pool) 39 const scoped_refptr<base::SequencedWorkerPool>& worker_pool)
15 : CrashUploadList(delegate, upload_log_path, worker_pool) {} 40 : CrashUploadList(delegate, upload_log_path, worker_pool) {}
16 41
17 CrashUploadListCrashpad::~CrashUploadListCrashpad() {} 42 CrashUploadListCrashpad::~CrashUploadListCrashpad() {}
18 43
19 void CrashUploadListCrashpad::LoadUploadList() { 44 void CrashUploadListCrashpad::LoadUploadList() {
20 std::vector<crash_reporter::UploadedReport> uploaded_reports; 45 std::vector<crash_reporter::UploadedReport> uploaded_reports;
46 #if defined(OS_WIN)
47 // On Windows, we only link crash client into chrome.exe (not the dlls), and
48 // it does the registration. That means the global that holds the crash report
49 // database lives in the .exe, so we need to grab a pointer to a helper in the
50 // exe to get our uploaded reports list.
51 GetUploadedReportsThunk(&uploaded_reports);
Mark Mentovai 2015/12/02 03:05:07 Maybe this ought to be done in crash_reporter::Get
scottmg 2015/12/02 05:35:00 I thought it was a bit better here because then at
Mark Mentovai 2015/12/02 14:59:23 scottmg wrote:
52 #else
21 crash_reporter::GetUploadedReports(&uploaded_reports); 53 crash_reporter::GetUploadedReports(&uploaded_reports);
54 #endif
22 55
23 ClearUploads(); 56 ClearUploads();
24 for (const crash_reporter::UploadedReport& uploaded_report : 57 for (const crash_reporter::UploadedReport& uploaded_report :
25 uploaded_reports) { 58 uploaded_reports) {
26 AppendUploadInfo( 59 AppendUploadInfo(
27 UploadInfo(uploaded_report.remote_id, 60 UploadInfo(uploaded_report.remote_id,
28 base::Time::FromTimeT(uploaded_report.creation_time), 61 base::Time::FromTimeT(uploaded_report.creation_time),
29 uploaded_report.local_id, base::Time())); 62 uploaded_report.local_id, base::Time()));
30 } 63 }
31 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698