Remove MediaStreamPrivate::scheduleDeferredTask
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Sep 2019 16:06:51 +0000 (16:06 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Sep 2019 16:06:51 +0000 (16:06 +0000)
commite56c8dcc2e76eb37831372ed6f26b1cdd30d94fe
tree9a93dd1132e6c87959d81a4dcca2f23db913a308
parent8006ac29ec3ec542f75d08b9bcb8d4806eb9b5c9
Remove MediaStreamPrivate::scheduleDeferredTask
https://bugs.webkit.org/show_bug.cgi?id=200975
LayoutTests/imported/w3c:

Reviewed by Eric Carlson.

* web-platform-tests/mediacapture-streams/MediaStream-finished-add.https-expected.txt:

Source/WebCore:

Reviewed by Eric Carlson.

All calls to scheduleDeferredTask are done on the main thread.
This was initially done to trigger less reconfiguration.
But this makes the implementation significantly more complex.

For instance, we have to wait for the document to update its media state
and send it to UIProcess before calling the allow completion handler.

Covered by existing tests.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream):
Make sure to update the document media state once the tracks have been added, similarly to the other constructor.
This ensures the document media state is computed with the new MediaStreamTrack.
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::isMediaStreamCorrectlyStarted):
(WebCore::UserMediaRequest::allow):
(WebCore::UserMediaRequest::stop):
(WebCore::UserMediaRequest::mediaStreamDidFail):
* Modules/mediastream/UserMediaRequest.h:
* page/MediaProducer.h:
(WebCore::MediaProducer::isCapturing):
Make sure to include getDisplayMedia as part of capture check.
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::trackMutedChanged):
(WebCore::MediaStreamPrivate::trackEnabledChanged):
(WebCore::MediaStreamPrivate::trackStarted):
(WebCore::MediaStreamPrivate::trackEnded):
* platform/mediastream/MediaStreamPrivate.h:

LayoutTests:

<rdar://problem/55113418>

Reviewed by Eric Carlson.

* fast/mediastream/media-stream-track-source-failure.html:
page mediaState may be updated synchronously.
Get it just before failing a capture track to verify that the state is being updated after the track is stopped.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/media-stream-track-source-failure.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-finished-add.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/mediastream/UserMediaRequest.h
Source/WebCore/page/MediaProducer.h
Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
Source/WebCore/platform/mediastream/MediaStreamPrivate.h