remoting: Invoke WebrtcDataStreamAdapter callbacks asynchronously.

webrtc::DataChannelObserver methods are called synchronously by the
WebRTC library, and may be invoked mid-operation.
WebrtcDataStreamAdapter was then using them to invoke (again
synchronously) the relevant MessagePipe::EventHandler callbacks. As a
result, it was possible to end up with nested callstacks where an inner
frame was deleting the WebrtcDataStreamAdapter while an outer frame was
still waiting for a send operation to return.

This change addresses the problem by always invoking callbacks
asynchronously in WebrtcDataStreamAdapter, ensuring the stack has a
chance to unwind.

Bug: 941661
Change-Id: Ieef7726ae8caebe160e74fc14bd9b4721811406d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1521479
Commit-Queue: Erik Jensen <rkjnsn@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#640535}
2 files changed