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

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

Issue 10983028: Render/pepper hang debugging: generate dumps for the browser and renderer processes if users kill a… (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
« no previous file with comments | « chrome/browser/hang_monitor/hang_crash_dump_win.h ('k') | chrome/browser/ui/hung_plugin_tab_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c327519c3e8e24d231a7a1fec5e3bd0ac40853a8..456aa389cff48f8e0b0df454eb3cfeefb9338987 100644
--- a/chrome/browser/hang_monitor/hang_crash_dump_win.cc
+++ b/chrome/browser/hang_monitor/hang_crash_dump_win.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/common/result_codes.h"
-#include "ppapi/shared_impl/ppapi_message_tracker.h"
namespace {
@@ -17,20 +16,6 @@ static const int kTerminateTimeoutMS = 2000;
// How long do we wait for the crash to be generated (in ms).
static const int kGenerateDumpTimeoutMS = 10000;
-DWORD WINAPI DumpIfHandlingPepper(void*) {
- typedef void (__cdecl *DumpFunction)();
- if (ppapi::PpapiMessageTracker::GetInstance()->IsHandlingMessage()) {
- DumpFunction request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
- GetModuleHandle(chrome::kBrowserProcessExecutableName),
- "DumpProcessWithoutCrash"));
- DCHECK(request_dump) << "Failed loading DumpProcessWithoutCrash: error " <<
- GetLastError();
- if (request_dump)
- request_dump();
- }
- return 0;
-}
-
} // namespace
void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
@@ -60,24 +45,31 @@ void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess) {
WaitForSingleObject(hprocess, kTerminateTimeoutMS);
}
-void CrashDumpIfProcessHandlingPepper(HANDLE hprocess) {
- // Unlike CrashDumpAndTerminateHungChildProcess() which creates a remote
- // thread using function pointer relative to chrome.exe, here we create a
- // remote thread using function pointer relative to chrome.dll. The reason is
- // that there are separate PpapiMessageTracker singletons for chrome.dll and
- // chrome.exe (in non-component build). We cannot access the information
- // collected by PpapiMessageTracker of chrome.dll in chrome.exe.
- //
- // This is less safe, because chrome.dll may be loaded at different addresses
- // in different processes. We could cause crash in that case. However, it
- // should be rare and we are only doing this temporarily for debugging on the
- // Canary channel.
- HANDLE remote_thread = CreateRemoteThread(hprocess, NULL, 0,
- DumpIfHandlingPepper, 0, 0, NULL);
- DCHECK(remote_thread) << "Failed creating remote thread: error " <<
- GetLastError();
- if (remote_thread) {
- WaitForSingleObject(remote_thread, kGenerateDumpTimeoutMS);
- CloseHandle(remote_thread);
+void CrashDumpForHangDebugging(HANDLE hprocess) {
+ if (hprocess == GetCurrentProcess()) {
+ typedef void (__cdecl *DumpFunction)();
+ DumpFunction request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
+ GetModuleHandle(chrome::kBrowserProcessExecutableName),
+ "DumpProcessWithoutCrash"));
+ DCHECK(request_dump) << "Failed loading DumpProcessWithoutCrash: error " <<
+ GetLastError();
+ if (request_dump)
+ request_dump();
+ } else {
+ typedef HANDLE (__cdecl *DumpFunction)(HANDLE);
+ DumpFunction request_dump = reinterpret_cast<DumpFunction>(GetProcAddress(
+ GetModuleHandle(chrome::kBrowserProcessExecutableName),
+ "InjectDumpForHangDebugging"));
+ DCHECK(request_dump) << "Failed loading InjectDumpForHangDebugging: error "
+ << GetLastError();
+ if (request_dump) {
+ HANDLE remote_thread = request_dump(hprocess);
+ DCHECK(remote_thread) << "Failed creating remote thread: error " <<
+ GetLastError();
+ if (remote_thread) {
+ WaitForSingleObject(remote_thread, kGenerateDumpTimeoutMS);
+ CloseHandle(remote_thread);
+ }
+ }
}
}
« no previous file with comments | « chrome/browser/hang_monitor/hang_crash_dump_win.h ('k') | chrome/browser/ui/hung_plugin_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698