OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_elf/chrome_elf_main.h" | 5 #include "chrome_elf/chrome_elf_main.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
| 9 #include "base/lazy_instance.h" |
| 10 #include "chrome/app/chrome_crash_reporter_client_win.h" |
9 #include "chrome/install_static/install_util.h" | 11 #include "chrome/install_static/install_util.h" |
10 #include "chrome_elf/blacklist/blacklist.h" | 12 #include "chrome_elf/blacklist/blacklist.h" |
11 #include "chrome_elf/breakpad.h" | 13 #include "chrome_elf/blacklist/crashpad_helper.h" |
| 14 #include "components/crash/content/app/crashpad.h" |
12 | 15 |
| 16 namespace { |
| 17 |
| 18 base::LazyInstance<std::vector<crash_reporter::Report>>::Leaky |
| 19 g_crash_reports = LAZY_INSTANCE_INITIALIZER; |
| 20 |
| 21 } // namespace |
13 | 22 |
14 void SignalChromeElf() { | 23 void SignalChromeElf() { |
15 blacklist::ResetBeacon(); | 24 blacklist::ResetBeacon(); |
16 } | 25 } |
17 | 26 |
| 27 // This helper is invoked by code in chrome.dll to retrieve the crash reports. |
| 28 // See CrashUploadListCrashpad. Note that we do not pass an std::vector here, |
| 29 // because we do not want to allocate/free in different modules. The returned |
| 30 // pointer is read-only. |
| 31 extern "C" __declspec(dllexport) void GetCrashReportsImpl( |
| 32 const crash_reporter::Report** reports, |
| 33 size_t* report_count) { |
| 34 crash_reporter::GetReports(g_crash_reports.Pointer()); |
| 35 *reports = g_crash_reports.Pointer()->data(); |
| 36 *report_count = g_crash_reports.Pointer()->size(); |
| 37 } |
| 38 |
18 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 39 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
19 if (reason == DLL_PROCESS_ATTACH) { | 40 if (reason == DLL_PROCESS_ATTACH) { |
| 41 ChromeCrashReporterClient::InitializeCrashReportingForProcess(); |
20 install_static::InitializeProcessType(); | 42 install_static::InitializeProcessType(); |
21 InitializeCrashReporting(); | |
22 | 43 |
23 __try { | 44 __try { |
24 blacklist::Initialize(false); // Don't force, abort if beacon is present. | 45 blacklist::Initialize(false); // Don't force, abort if beacon is present. |
25 } __except(GenerateCrashDump(GetExceptionInformation())) { | 46 } __except(GenerateCrashDump(GetExceptionInformation())) { |
26 } | 47 } |
27 } | 48 } |
28 | 49 |
29 return TRUE; | 50 return TRUE; |
30 } | 51 } |
OLD | NEW |