Fix Mojo broker crash on Windows.

This occurred because a ChildBrokerHost noticed that its connection to the child process died and so it nulled out its channel. On POSIX, this leads to the destruction of the ChildBrokerHost immediately and so the singleton BrokerState is notified synchronously. On Windows, there's another channel for sandboxing related sync IPCs which uses IO completition ports. To ease lifetime issues because of that, the ChildBrokerHost is only deleted in response to errors from that second channel. So if the first channel dies first, it is possible that BrokerState tries to connect to a message pipe in that ChildBrokerState with a null channel.

The fix is to null check the channel and to inform the other side of the message pipe that its peer has died so that it can fire peer closed notifications.

BUG=573244

Review URL: https://codereview.chromium.org/1558643002

Cr-Commit-Position: refs/heads/master@{#367194}


CrOS-Libchrome-Original-Commit: 9b6da52718d7413adb9eec3a2d7f32ce3e04c7ce
6 files changed
tree: 4b3eca3e853c125debb2d89f31ed3be6a0854815
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/