[mojo-edk] Prevent closed port from accepting new messages

Previously it was possible for a message to arrive just
before closing a port. In this case OnUserMessage would
grab a ref to the Port object (thus keeping it alive),
ClosePort would close the port (in turn closing any
ports referenced by its message queue), and then it
would be possible for OnUserMessage to continue by
locking the port and enqueueing a (potentially port-
carrying) message onto the queue.

This resolves the issue by making CanAcceptMoreMessages
fail if the port is closed.

Also minor cleanup removing the unused ErasePort method.

TBR=amistry@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/1985833002
Cr-Commit-Position: refs/heads/master@{#393947}


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