| 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);
|
| +}
|
|
|