-
Henrik Boström authored
With this change, onsignalingstatechange always fires before the setLocalDescription's promise resolves. Before this change, signaling state changes were surfaced with callbacks firing separately from the callback that setLocalDescription or setRemoteDescription had completed. As a result, the result of a SLD/SRD operation was surfaced in two PostTasks instead of one. This could lead to flaky behavior where JavaScript task execeution cycles may or may not execute between PostTasks which lead to undefined order. Also when the signalingstatechange was surfaced to the JS thread the firing of the event was delayed by a task execution cycle due to ScheduleDispatchEvent. - If both PostTasks were handled in the same cycle, the event firing would be scheduled and the promise resolved, such that the promise's then() is invoked just before the event fires (scheduled after promise). This is NOT in accordance with the spec. - If onsignalingstatechange's PostTask was handled in its own cycle, the event would be scheduled such that by the time the setLocalDescription's callback's PostTask occurs resolving the promise, the event would fire before the promise's then(). This IS in accordance with the spec. With this change, the onsignalingstatechange event is fired without delay, and it is processed in by the same observer that handles the SLD/SRD callback, so the order is always guaranteed to be the same. In addition, this CL removes the usage of WebRTCPeerConnectionHandlerClient::SignalingState and relies on the webrtc::PeerConnectionInterface::SignalingState enum directly. This is part of the Onion Souping work (crbug.com/787254). Bug: 848768, 787254 Change-Id: I7bc10439c44c6ff6beab0289975295ff2e051b9c Reviewed-on: https://chromium-review.googlesource.com/1085302 Commit-Queue: Henrik Boström <hbos@chromium.org> Reviewed-by:
Guido Urdaneta <guidou@chromium.org> Cr-Commit-Position: refs/heads/master@{#565291}
c220be7c