Index: content/child/child_thread_impl.cc |
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc |
index 90e1e698856c11fe28eb36ee3f3320d3feceac77..8dafe6c190705ee1f3d4048c7d4de1f163f1ee3d 100644 |
--- a/content/child/child_thread_impl.cc |
+++ b/content/child/child_thread_impl.cc |
@@ -619,7 +619,10 @@ void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) { |
void ChildThreadImpl::OnChannelError() { |
on_channel_error_called_ = true; |
- base::MessageLoop::current()->QuitWhenIdle(); |
+ // If this thread runs in the browser process, only Thread::Stop should |
+ // stop its message loop. Otherwise, QuitWhenIdle could race Thread::Stop. |
+ if (!IsInBrowserProcess()) |
+ base::MessageLoop::current()->QuitWhenIdle(); |
} |
bool ChildThreadImpl::Send(IPC::Message* msg) { |