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

Side by Side Diff: chrome_elf/chrome_elf_main.cc

Issue 2475863004: Make Crashpad start asynchronous, and move back to chrome_elf (Closed)
Patch Set: comment Created 4 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
« no previous file with comments | « chrome_elf/chrome_elf_main.h ('k') | components/crash/content/app/crashpad.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <assert.h> 7 #include <assert.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "chrome/install_static/install_details.h" 10 #include "chrome/install_static/install_details.h"
11 #include "chrome/install_static/install_util.h" 11 #include "chrome/install_static/install_util.h"
12 #include "chrome/install_static/product_install_details.h" 12 #include "chrome/install_static/product_install_details.h"
13 #include "chrome/install_static/user_data_dir.h" 13 #include "chrome/install_static/user_data_dir.h"
14 #include "chrome_elf/blacklist/blacklist.h" 14 #include "chrome_elf/blacklist/blacklist.h"
15 #include "chrome_elf/crash/crash_helper.h" 15 #include "chrome_elf/crash/crash_helper.h"
16 16
17 // This function is a temporary workaround for https://crbug.com/655788. We
18 // need to come up with a better way to initialize crash reporting that can
19 // happen inside DllMain().
20 void SignalInitializeCrashReporting() {
21 if (!elf_crash::InitializeCrashReporting()) {
22 #ifdef _DEBUG
23 assert(false);
24 #endif // _DEBUG
25 }
26 }
27
28 void SignalChromeElf() { 17 void SignalChromeElf() {
29 blacklist::ResetBeacon(); 18 blacklist::ResetBeacon();
30 } 19 }
31 20
32 extern "C" void GetUserDataDirectoryThunk(wchar_t* user_data_dir, 21 extern "C" void GetUserDataDirectoryThunk(wchar_t* user_data_dir,
33 size_t user_data_dir_length, 22 size_t user_data_dir_length,
34 wchar_t* invalid_user_data_dir, 23 wchar_t* invalid_user_data_dir,
35 size_t invalid_user_data_dir_length) { 24 size_t invalid_user_data_dir_length) {
36 std::wstring user_data_dir_str, invalid_user_data_dir_str; 25 std::wstring user_data_dir_str, invalid_user_data_dir_str;
37 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str, 26 bool ret = install_static::GetUserDataDirectory(&user_data_dir_str,
(...skipping 10 matching lines...) Expand all
48 // install_static::InstallDetails::InitializeFromPrimaryModule. 37 // install_static::InstallDetails::InitializeFromPrimaryModule.
49 extern "C" const install_static::InstallDetails::Payload* 38 extern "C" const install_static::InstallDetails::Payload*
50 GetInstallDetailsPayload() { 39 GetInstallDetailsPayload() {
51 return install_static::InstallDetails::Get().GetPayload(); 40 return install_static::InstallDetails::Get().GetPayload();
52 } 41 }
53 42
54 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { 43 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {
55 if (reason == DLL_PROCESS_ATTACH) { 44 if (reason == DLL_PROCESS_ATTACH) {
56 install_static::InitializeProductDetailsForPrimaryModule(); 45 install_static::InitializeProductDetailsForPrimaryModule();
57 46
47 if (!elf_crash::InitializeCrashReporting()) {
48 assert(false);
49 }
50
58 // CRT on initialization installs an exception filter which calls 51 // CRT on initialization installs an exception filter which calls
59 // TerminateProcess. We need to hook CRT's attempt to set an exception. 52 // TerminateProcess. We need to hook CRT's attempt to set an exception.
60 elf_crash::DisableSetUnhandledExceptionFilter(); 53 elf_crash::DisableSetUnhandledExceptionFilter();
61 54
62 install_static::InitializeProcessType(); 55 install_static::InitializeProcessType();
63 56
64 __try { 57 __try {
65 blacklist::Initialize(false); // Don't force, abort if beacon is present. 58 blacklist::Initialize(false); // Don't force, abort if beacon is present.
66 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { 59 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) {
67 } 60 }
68 } else if (reason == DLL_PROCESS_DETACH) { 61 } else if (reason == DLL_PROCESS_DETACH) {
69 elf_crash::ShutdownCrashReporting(); 62 elf_crash::ShutdownCrashReporting();
70 } 63 }
71 return TRUE; 64 return TRUE;
72 } 65 }
OLDNEW
« no previous file with comments | « chrome_elf/chrome_elf_main.h ('k') | components/crash/content/app/crashpad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698