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_process_host.h" | 5 #include "chrome/common/child_process_host.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Singleton<ChildProcessList>::get()->push_back(this); | 48 Singleton<ChildProcessList>::get()->push_back(this); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 ChildProcessHost::~ChildProcessHost() { | 52 ChildProcessHost::~ChildProcessHost() { |
53 Singleton<ChildProcessList>::get()->remove(this); | 53 Singleton<ChildProcessList>::get()->remove(this); |
54 | 54 |
55 if (handle()) { | 55 if (handle()) { |
56 watcher_.StopWatching(); | 56 watcher_.StopWatching(); |
57 ProcessWatcher::EnsureProcessTerminated(handle()); | 57 ProcessWatcher::EnsureProcessTerminated(handle()); |
| 58 |
| 59 // Above call took ownership, so don't want WaitableEvent to assert because |
| 60 // the handle isn't valid anymore. |
| 61 process_event_->Release(); |
58 } | 62 } |
59 } | 63 } |
60 | 64 |
61 bool ChildProcessHost::CreateChannel() { | 65 bool ChildProcessHost::CreateChannel() { |
62 channel_id_ = GenerateRandomChannelID(this); | 66 channel_id_ = GenerateRandomChannelID(this); |
63 channel_.reset(new IPC::Channel( | 67 channel_.reset(new IPC::Channel( |
64 channel_id_, IPC::Channel::MODE_SERVER, &listener_)); | 68 channel_id_, IPC::Channel::MODE_SERVER, &listener_)); |
65 if (!channel_->Connect()) | 69 if (!channel_->Connect()) |
66 return false; | 70 return false; |
67 | 71 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 186 |
183 return *iterator_; | 187 return *iterator_; |
184 } while (true); | 188 } while (true); |
185 | 189 |
186 return NULL; | 190 return NULL; |
187 } | 191 } |
188 | 192 |
189 bool ChildProcessHost::Iterator::Done() { | 193 bool ChildProcessHost::Iterator::Done() { |
190 return iterator_ == Singleton<ChildProcessList>::get()->end(); | 194 return iterator_ == Singleton<ChildProcessList>::get()->end(); |
191 } | 195 } |
OLD | NEW |