Chromium Code Reviews| Index: content/child/child_process.cc |
| diff --git a/content/child/child_process.cc b/content/child/child_process.cc |
| index 01675b321f75522a487e83c714780307f89c228e..ec7ecd11f77e63f8a2aec722282c7add39f9c08f 100644 |
| --- a/content/child/child_process.cc |
| +++ b/content/child/child_process.cc |
| @@ -54,19 +54,18 @@ ChildProcess::ChildProcess() |
| ChildProcess::~ChildProcess() { |
| DCHECK(g_lazy_tls.Pointer()->Get() == this); |
| + // Kill the main thread object before nulling child_process, since |
| + // destruction code might depend on it. |
| + if (main_thread_) // null in unittests. |
| + main_thread_->Shutdown(); |
|
piman
2015/09/14 21:54:38
I think you still want to do this after shutdown_e
reveman
2015/09/15 20:38:35
Done. But that meant allowing ChildThreadImpl::All
|
| + |
| // Signal this event before destroying the child process. That way all |
| // background threads can cleanup. |
| // For example, in the renderer the RenderThread instances will be able to |
| // notice shutdown before the render process begins waiting for them to exit. |
| shutdown_event_.Signal(); |
| - // Kill the main thread object before nulling child_process, since |
| - // destruction code might depend on it. |
| - if (main_thread_) { // null in unittests. |
| - main_thread_->Shutdown(); |
| - main_thread_.reset(); |
| - } |
| - |
| + main_thread_.reset(); |
| g_lazy_tls.Pointer()->Set(NULL); |
| io_thread_.Stop(); |
| } |