| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/child_thread.h" | 5 #include "chrome/common/child_thread.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/common/child_process.h" | 10 #include "chrome/common/child_process.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 notification_service_.reset(new NotificationService); | 64 notification_service_.reset(new NotificationService); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ChildThread::~ChildThread() { | 67 ChildThread::~ChildThread() { |
| 68 #ifdef IPC_MESSAGE_LOG_ENABLED | 68 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 69 IPC::Logging::current()->SetIPCSender(NULL); | 69 IPC::Logging::current()->SetIPCSender(NULL); |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 channel_->RemoveFilter(sync_message_filter_.get()); | 72 channel_->RemoveFilter(sync_message_filter_.get()); |
| 73 | 73 |
| 74 // Close this channel before resetting the message loop attached to it so |
| 75 // the message loop can call ChannelProxy::Context::OnChannelClosed(), which |
| 76 // releases the reference count to this channel. |
| 77 channel_->Close(); |
| 78 |
| 74 // The ChannelProxy object caches a pointer to the IPC thread, so need to | 79 // The ChannelProxy object caches a pointer to the IPC thread, so need to |
| 75 // reset it as it's not guaranteed to outlive this object. | 80 // reset it as it's not guaranteed to outlive this object. |
| 76 // NOTE: this also has the side-effect of not closing the main IPC channel to | 81 // NOTE: this also has the side-effect of not closing the main IPC channel to |
| 77 // the browser process. This is needed because this is the signal that the | 82 // the browser process. This is needed because this is the signal that the |
| 78 // browser uses to know that this process has died, so we need it to be alive | 83 // browser uses to know that this process has died, so we need it to be alive |
| 79 // until this process is shut down, and the OS closes the handle | 84 // until this process is shut down, and the OS closes the handle |
| 80 // automatically. We used to watch the object handle on Windows to do this, | 85 // automatically. We used to watch the object handle on Windows to do this, |
| 81 // but it wasn't possible to do so on POSIX. | 86 // but it wasn't possible to do so on POSIX. |
| 82 channel_->ClearIPCMessageLoop(); | 87 channel_->ClearIPCMessageLoop(); |
| 83 } | 88 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 MessageLoop::current()->Quit(); | 195 MessageLoop::current()->Quit(); |
| 191 return; | 196 return; |
| 192 } | 197 } |
| 193 | 198 |
| 194 // The child process shutdown sequence is a request response based mechanism, | 199 // The child process shutdown sequence is a request response based mechanism, |
| 195 // where we send out an initial feeler request to the child process host | 200 // where we send out an initial feeler request to the child process host |
| 196 // instance in the browser to verify if it's ok to shutdown the child process. | 201 // instance in the browser to verify if it's ok to shutdown the child process. |
| 197 // The browser then sends back a response if it's ok to shutdown. | 202 // The browser then sends back a response if it's ok to shutdown. |
| 198 Send(new PluginProcessHostMsg_ShutdownRequest); | 203 Send(new PluginProcessHostMsg_ShutdownRequest); |
| 199 } | 204 } |
| OLD | NEW |