summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/breakpad_win.cc16
-rw-r--r--chrome/browser/DEPS4
-rw-r--r--chrome/browser/hang_monitor/hang_crash_dump_win.cc60
-rw-r--r--chrome/browser/hang_monitor/hang_crash_dump_win.h6
-rw-r--r--chrome/browser/ui/hung_plugin_tab_helper.cc11
5 files changed, 54 insertions, 43 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index d4f7eed..ca1e667 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -130,6 +130,22 @@ InjectDumpProcessWithoutCrash(HANDLE process) {
0, 0, NULL);
}
+// The following two functions do exactly the same thing as the two above. But
+// we want the signatures to be different so that we can easily track them in
+// crash reports.
+// TODO(yzshen): Remove when enough information is collected and the hang rate
+// of pepper/renderer processes is reduced.
+DWORD WINAPI DumpForHangDebuggingThread(void*) {
+ DumpProcessWithoutCrash();
+ return 0;
+}
+
+extern "C" HANDLE __declspec(dllexport) __cdecl
+InjectDumpForHangDebugging(HANDLE process) {
+ return CreateRemoteThread(process, NULL, 0, DumpForHangDebuggingThread,
+ 0, 0, NULL);
+}
+
// Reduces the size of the string |str| to a max of 64 chars. Required because
// breakpad's CustomInfoEntry raises an invalid_parameter error if the string
// we want to set is longer.
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index e949f2c..b57c3f5 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -16,10 +16,6 @@ include_rules = [
"+ppapi/host",
"+ppapi/proxy",
"+ppapi/shared_impl/api_id.h",
- # Provide debug info for detecting inter-process pepper deadlocks.
- # TODO(yzshen): Remove when enough information is collected and the hang rate
- # of pepper/renderer processes is reduced.
- "+ppapi/shared_impl/ppapi_message_tracker.h",
# Defines some types that are marshalled over IPC.
"+ppapi/shared_impl/ppp_flash_browser_operations_shared.h",
"+rlz",
diff --git a/chrome/browser/hang_monitor/hang_crash_dump_win.cc b/chrome/browser/hang_monitor/hang_crash_dump_win.cc
index c327519..456aa38 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);
+ }
+ }
}
}
diff --git a/chrome/browser/hang_monitor/hang_crash_dump_win.h b/chrome/browser/hang_monitor/hang_crash_dump_win.h
index a3d02b7..1f7d798 100644
--- a/chrome/browser/hang_monitor/hang_crash_dump_win.h
+++ b/chrome/browser/hang_monitor/hang_crash_dump_win.h
@@ -11,8 +11,8 @@
// process.
void CrashDumpAndTerminateHungChildProcess(HANDLE hprocess);
-// Causes the given process to generate a crash dump if it is handling pepper
-// messages.
-void CrashDumpIfProcessHandlingPepper(HANDLE hprocess);
+// TODO(yzshen): Remove when enough information is collected and the hang rate
+// of pepper/renderer processes is reduced.
+void CrashDumpForHangDebugging(HANDLE hprocess);
#endif // CHROME_BROWSER_HANG_MONITOR_HANG_CRASH_DUMP_WIN_H_
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc
index 39513bd9..26dc863 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.cc
+++ b/chrome/browser/ui/hung_plugin_tab_helper.cc
@@ -67,11 +67,15 @@ class OwnedHandleVector {
DISALLOW_COPY_AND_ASSIGN(OwnedHandleVector);
};
+void DumpBrowserInBlockingPool() {
+ CrashDumpForHangDebugging(::GetCurrentProcess());
+}
+
void DumpRenderersInBlockingPool(OwnedHandleVector* renderer_handles) {
for (std::vector<HANDLE>::const_iterator iter =
renderer_handles->data().begin();
iter != renderer_handles->data().end(); ++iter) {
- CrashDumpIfProcessHandlingPepper(*iter);
+ CrashDumpForHangDebugging(*iter);
}
}
@@ -316,7 +320,10 @@ void HungPluginTabHelper::KillPlugin(int child_id) {
// due to our crash dump uploading restrictions. So we just don't generate
// renderer crash dumps in that case.
if (renderer_handles->data().size() > 0 &&
- renderer_handles->data().size() < 8) {
+ renderer_handles->data().size() < 4) {
+ content::BrowserThread::PostBlockingPoolSequencedTask(
+ kDumpChildProcessesSequenceName, FROM_HERE,
+ base::Bind(&DumpBrowserInBlockingPool));
content::BrowserThread::PostBlockingPoolSequencedTask(
kDumpChildProcessesSequenceName, FROM_HERE,
base::Bind(&DumpRenderersInBlockingPool,