Index: content/browser/bad_message.cc |
diff --git a/content/browser/bad_message.cc b/content/browser/bad_message.cc |
index f7e30368f89b83bab714ea71f2c8c0f220946ad0..84d3e24ebd199ff36dc72aa18f799fe564283a27 100644 |
--- a/content/browser/bad_message.cc |
+++ b/content/browser/bad_message.cc |
@@ -4,9 +4,11 @@ |
#include "content/browser/bad_message.h" |
+#include "base/bind.h" |
#include "base/logging.h" |
#include "base/metrics/sparse_histogram.h" |
#include "content/public/browser/browser_message_filter.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_process_host.h" |
namespace content { |
@@ -19,6 +21,14 @@ void LogBadMessage(BadMessageReason reason) { |
UMA_HISTOGRAM_SPARSE_SLOWLY("Stability.BadMessageTerminated.Content", reason); |
} |
+void ReceivedBadMessageOnUIThread(int render_process_id, |
+ BadMessageReason reason) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); |
+ if (host) |
+ ReceivedBadMessage(host, reason); |
+} |
+ |
} // namespace |
void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason) { |
@@ -26,6 +36,17 @@ void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason) { |
host->ShutdownForBadMessage(); |
} |
+void ReceivedBadMessage(int render_process_id, BadMessageReason reason) { |
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&ReceivedBadMessageOnUIThread, render_process_id, reason)); |
+ return; |
+ } |
+ ReceivedBadMessageOnUIThread(render_process_id, reason); |
+} |
+ |
void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason) { |
LogBadMessage(reason); |
filter->ShutdownForBadMessage(); |