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

Unified Diff: chrome/browser/hang_monitor/hang_crash_dump_win.cc

Issue 10909241: Generate dumps for relevant renderers when users kill a hung pepper plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/hang_monitor/hang_crash_dump_win.cc
diff --git a/chrome/browser/hang_monitor/hang_crash_dump_win.cc b/chrome/browser/hang_monitor/hang_crash_dump_win.cc
index c2a910bdb304326164676529bf9fa6c13cc07708..799fc57831b62f04a98bd665ed581522b1bf8edb 100644
--- a/chrome/browser/hang_monitor/hang_crash_dump_win.cc
+++ b/chrome/browser/hang_monitor/hang_crash_dump_win.cc
@@ -16,21 +16,11 @@ static const int kTerminateTimeoutMS = 2000;
// How long do we wait for the crash to be generated (in ms).
static const int kGenerateDumpTimeoutMS = 10000;
-} // namespace
-
-void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
- // Before terminating the process we try collecting a dump. Which
- // a transient thread in the child process will do for us.
- typedef HANDLE (__cdecl *DumpFunction)(HANDLE);
- static DumpFunction request_dump = NULL;
- if (!request_dump) {
- request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
- GetModuleHandle(chrome::kBrowserProcessExecutableName),
- "InjectDumpProcessWithoutCrash"));
- DCHECK(request_dump) << "Failed loading DumpProcessWithoutCrash: error " <<
- GetLastError();
- }
+typedef HANDLE (__cdecl *DumpFunction)(HANDLE);
+void RunDumpFunction(HANDLE hprocess, DumpFunction request_dump) {
+ // Try collecting a dump. Which a transient thread in the child process will
+ // do for us.
if (request_dump) {
HANDLE remote_thread = request_dump(hprocess);
DCHECK(remote_thread) << "Failed creating remote thread: error " <<
@@ -40,7 +30,33 @@ void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
CloseHandle(remote_thread);
}
}
+}
+
+} // namespace
+
+void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
+ static DumpFunction request_dump = NULL;
+ if (!request_dump) {
+ request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
+ GetModuleHandle(chrome::kBrowserProcessExecutableName),
+ "InjectDumpProcessWithoutCrash"));
+ DCHECK(request_dump) << "Failed loading DumpProcessWithoutCrash: error " <<
+ GetLastError();
+ }
+ RunDumpFunction(hprocess, request_dump);
TerminateProcess(hprocess, content::RESULT_CODE_HUNG);
WaitForSingleObject(hprocess, kTerminateTimeoutMS);
}
+
+void CrashDumpProcessHandlingPepper(HANDLE hprocess) {
+ static DumpFunction request_dump = NULL;
+ if (!request_dump) {
+ request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
+ GetModuleHandle(chrome::kBrowserProcessExecutableName),
+ "InjectDumpProcessHandlingPepper"));
+ DCHECK(request_dump) << "Failed loading DumpProcessHandlingPepper: error "
+ << GetLastError();
+ }
+ RunDumpFunction(hprocess, request_dump);
+}

Powered by Google App Engine
This is Rietveld 408576698