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

Side by Side Diff: chrome/browser/hang_monitor/hang_crash_dump_win.cc

Issue 10257028: Revert 134443 - Broke win_aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h"
6
7 #include "chrome/common/chrome_constants.h"
8 #include "content/public/common/result_codes.h"
9
10 namespace {
11
12 // This function will be called via an injected thread in the hung plugin
13 // process. calling DumpProcessWithoutCrash causes breakpad to capture a dump of
14 // the process.
15 DWORD WINAPI HungPluginDumpAndExit(void*) {
16 typedef void (__cdecl *DumpProcessFunction)();
17 DumpProcessFunction request_dump = reinterpret_cast<DumpProcessFunction>(
18 GetProcAddress(GetModuleHandle(chrome::kBrowserProcessExecutableName),
19 "DumpProcessWithoutCrash"));
20 if (request_dump)
21 request_dump();
22 return 0;
23 }
24
25 // How long do we wait for the terminated thread or process to die (in ms)
26 static const int kTerminateTimeoutMS = 2000;
27
28 // How long do we wait for the crash to be generated (in ms).
29 static const int kGenerateDumpTimeoutMS = 10000;
30
31 } // namespace
32
33 void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
34 // Before terminating the process we try collecting a dump. Which
35 // a transient thread in the child process will do for us.
36 HANDLE remote_thread = CreateRemoteThread(hprocess, NULL, 0,
37 &HungPluginDumpAndExit, 0, 0, NULL);
38 if (remote_thread) {
39 WaitForSingleObject(remote_thread, kGenerateDumpTimeoutMS);
40 CloseHandle(remote_thread);
41 }
42
43 TerminateProcess(hprocess, content::RESULT_CODE_HUNG);
44 WaitForSingleObject(hprocess, kTerminateTimeoutMS);
45 }
OLDNEW
« no previous file with comments | « chrome/browser/hang_monitor/hang_crash_dump_win.h ('k') | chrome/browser/hang_monitor/hung_window_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698