OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mojo/edk/system/child_broker.h" | 5 #include "mojo/edk/system/child_broker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (peer_pid == 0) { | 213 if (peer_pid == 0) { |
214 // The other side is in the parent process. | 214 // The other side is in the parent process. |
215 AttachMessagePipe(pipe, pipe_id, parent_async_channel_); | 215 AttachMessagePipe(pipe, pipe_id, parent_async_channel_); |
216 } else if (channels_.find(peer_pid) == channels_.end()) { | 216 } else if (channels_.find(peer_pid) == channels_.end()) { |
217 // We saw the peer process die before we got the reply from the parent. | 217 // We saw the peer process die before we got the reply from the parent. |
218 pipe->OnError(ERROR_READ_SHUTDOWN); | 218 pipe->OnError(ERROR_READ_SHUTDOWN); |
219 } else { | 219 } else { |
220 CHECK(connected_pipes_.find(pipe) == connected_pipes_.end()); | 220 CHECK(connected_pipes_.find(pipe) == connected_pipes_.end()); |
221 AttachMessagePipe(pipe, pipe_id, channels_[peer_pid]); | 221 AttachMessagePipe(pipe, pipe_id, channels_[peer_pid]); |
222 } | 222 } |
| 223 } else if (type == PEER_DIED) { |
| 224 DCHECK(!platform_handles); |
| 225 const PeerDiedMessage* message = |
| 226 static_cast<const PeerDiedMessage*>(message_view.bytes()); |
| 227 |
| 228 uint64_t pipe_id = message->pipe_id; |
| 229 |
| 230 CHECK(pending_connects_.find(pipe_id) != pending_connects_.end()); |
| 231 MessagePipeDispatcher* pipe = pending_connects_[pipe_id]; |
| 232 pending_connects_.erase(pipe_id); |
| 233 pipe->OnError(ERROR_READ_SHUTDOWN); |
223 } else { | 234 } else { |
224 NOTREACHED(); | 235 NOTREACHED(); |
225 } | 236 } |
226 } | 237 } |
227 | 238 |
228 void ChildBroker::OnError(Error error) { | 239 void ChildBroker::OnError(Error error) { |
229 // The parent process shut down. | 240 // The parent process shut down. |
230 } | 241 } |
231 | 242 |
232 void ChildBroker::ChannelDestructed(RoutedRawChannel* channel) { | 243 void ChildBroker::ChannelDestructed(RoutedRawChannel* channel) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if (WriteAndReadResponse(&message, handles, response_size)) { | 339 if (WriteAndReadResponse(&message, handles, response_size)) { |
329 server->reset(PlatformHandle(handles[0])); | 340 server->reset(PlatformHandle(handles[0])); |
330 client->reset(PlatformHandle(handles[1])); | 341 client->reset(PlatformHandle(handles[1])); |
331 } | 342 } |
332 } | 343 } |
333 | 344 |
334 #endif | 345 #endif |
335 | 346 |
336 } // namespace edk | 347 } // namespace edk |
337 } // namespace mojo | 348 } // namespace mojo |
OLD | NEW |