Index: content/common/child_thread.cc |
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc |
index 92d2ccac0af39c2efd4aa36c76a6bd1581a98211..a7dc9b9e5ce40d6f0a6509f9ef3926d6d38877ea 100644 |
--- a/content/common/child_thread.cc |
+++ b/content/common/child_thread.cc |
@@ -35,6 +35,7 @@ ChildThread::ChildThread(const std::string& channel_name) |
void ChildThread::Init() { |
check_with_browser_before_shutdown_ = false; |
+ is_waiting_to_shutdown_ = false; |
on_channel_error_called_ = false; |
message_loop_ = MessageLoop::current(); |
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { |
@@ -184,7 +185,8 @@ void ChildThread::OnAskBeforeShutdown() { |
} |
void ChildThread::OnShutdown() { |
- MessageLoop::current()->Quit(); |
+ if (is_waiting_to_shutdown_) |
+ MessageLoop::current()->Quit(); |
} |
#if defined(IPC_MESSAGE_LOG_ENABLED) |
@@ -210,5 +212,11 @@ void ChildThread::OnProcessFinalRelease() { |
// where we send out an initial feeler request to the child process host |
// instance in the browser to verify if it's ok to shutdown the child process. |
// The browser then sends back a response if it's ok to shutdown. |
+ is_waiting_to_shutdown_ = true; |
Send(new ChildProcessHostMsg_ShutdownRequest); |
} |
+ |
+void ChildThread::AbortProcessShutdown() { |
+ is_waiting_to_shutdown_ = false; |
+ MessageLoop::current()->CancelQuit(); |
+} |