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

Side by Side Diff: chrome_elf/crash/crash_helper.cc

Issue 2306613003: Restore the chrome watcher pending relocation (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/crash/crash_helper.h" 5 #include "chrome_elf/crash/crash_helper.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // information about why we intercept the SetUnhandledExceptionFilter API. 96 // information about why we intercept the SetUnhandledExceptionFilter API.
97 void DisableSetUnhandledExceptionFilter() { 97 void DisableSetUnhandledExceptionFilter() {
98 if (!g_crash_helper_enabled) 98 if (!g_crash_helper_enabled)
99 return; 99 return;
100 if (g_set_unhandled_exception_filter->Hook( 100 if (g_set_unhandled_exception_filter->Hook(
101 ::GetModuleHandle(nullptr), "kernel32.dll", 101 ::GetModuleHandle(nullptr), "kernel32.dll",
102 "SetUnhandledExceptionFilter", 102 "SetUnhandledExceptionFilter",
103 SetUnhandledExceptionFilterPatch) != NO_ERROR) { 103 SetUnhandledExceptionFilterPatch) != NO_ERROR) {
104 #ifdef _DEBUG 104 #ifdef _DEBUG
105 assert(false); 105 assert(false);
106 #endif //_DEBUG 106 #endif // _DEBUG
107 } 107 }
108 } 108 }
109 109
110 int GenerateCrashDump(EXCEPTION_POINTERS* exception_pointers) { 110 int GenerateCrashDump(EXCEPTION_POINTERS* exception_pointers) {
111 if (g_crash_helper_enabled) 111 if (g_crash_helper_enabled)
112 crashpad::CrashpadClient::DumpWithoutCrash( 112 crashpad::CrashpadClient::DumpWithoutCrash(
113 *(exception_pointers->ContextRecord)); 113 *(exception_pointers->ContextRecord));
114 return EXCEPTION_CONTINUE_SEARCH; 114 return EXCEPTION_CONTINUE_SEARCH;
115 } 115 }
116 116
117 } // namespace elf_crash 117 } // namespace elf_crash
118 118
119 //------------------------------------------------------------------------------ 119 //------------------------------------------------------------------------------
120 // Exported crash APIs for the rest of the process. 120 // Exported crash APIs for the rest of the process.
121 //------------------------------------------------------------------------------ 121 //------------------------------------------------------------------------------
122 122
123 // This helper is invoked by chrome to read upload settings.
124 extern "C" __declspec(dllexport) bool GetUploadsEnabled() {
125 return crash_reporter::GetUploadsEnabled();
126 }
127
123 // This helper is invoked by code in chrome.dll to retrieve the crash reports. 128 // This helper is invoked by code in chrome.dll to retrieve the crash reports.
124 // See CrashUploadListCrashpad. Note that we do not pass a std::vector here, 129 // See CrashUploadListCrashpad. Note that we do not pass a std::vector here,
125 // because we do not want to allocate/free in different modules. The returned 130 // because we do not want to allocate/free in different modules. The returned
126 // pointer is read-only. 131 // pointer is read-only.
127 // 132 //
128 // NOTE: Since the returned pointer references read-only memory that will be 133 // NOTE: Since the returned pointer references read-only memory that will be
129 // cleaned up when this DLL unloads, be careful not to reference the memory 134 // cleaned up when this DLL unloads, be careful not to reference the memory
130 // beyond that point (e.g. during tests). 135 // beyond that point (e.g. during tests).
131 extern "C" __declspec(dllexport) void GetCrashReportsImpl( 136 extern "C" __declspec(dllexport) void GetCrashReportsImpl(
132 const crash_reporter::Report** reports, 137 const crash_reporter::Report** reports,
133 size_t* report_count) { 138 size_t* report_count) {
134 if (!g_crash_helper_enabled) 139 if (!g_crash_helper_enabled)
135 return; 140 return;
136 crash_reporter::GetReports(g_crash_reports); 141 crash_reporter::GetReports(g_crash_reports);
137 *reports = g_crash_reports->data(); 142 *reports = g_crash_reports->data();
138 *report_count = g_crash_reports->size(); 143 *report_count = g_crash_reports->size();
139 } 144 }
140 145
141 // This helper is invoked by debugging code in chrome to register the client 146 // This helper is invoked by debugging code in chrome to register the client
142 // id. 147 // id.
143 extern "C" __declspec(dllexport) void SetMetricsClientId( 148 extern "C" __declspec(dllexport) void SetMetricsClientId(
144 const char* client_id) { 149 const char* client_id) {
145 if (!g_crash_helper_enabled) 150 if (!g_crash_helper_enabled)
146 return; 151 return;
147 if (client_id) 152 if (client_id)
148 crash_keys::SetMetricsClientIdFromGUID(client_id); 153 crash_keys::SetMetricsClientIdFromGUID(client_id);
149 } 154 }
OLDNEW
« chrome/app/main_dll_loader_win.cc ('K') | « chrome/app/main_dll_loader_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698