Refactoring: Convert HTMLMediaElement::scheduleDelayedAction() to individually schedu...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 23:12:53 +0000 (23:12 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 23:12:53 +0000 (23:12 +0000)
commit6f4a9525c4890d57bad714dffb35aba8c7939f3f
tree94d89ec8b28f35caf360064e251bbf2330c98ae3
parent135e4cb714a8f459a36518c040149cbff74cf4c1
Refactoring: Convert HTMLMediaElement::scheduleDelayedAction() to individually schedulable & cancelable tasks
https://bugs.webkit.org/show_bug.cgi?id=188208

Reviewed by Eric Carlson.

Rather than have a single, monolithic, zero-duration-timer based dispatch for
a bunch of methods to be performed in a future run-loop, convert them all to
use a DeferrableTask, which in turn is a kind of GenericTaskQueue which can
enqueue only a single task at a time. Convert some other zero-duration-timer
and GenericTaskQueue dispatches to this new DeferrableTask.

* WebCore.xcodeproj/project.pbxproj:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::finishParsingChildren):
(WebCore::HTMLMediaElement::scheduleCheckPlaybackTargetCompatability):
(WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::seekWithTolerance):
(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
(WebCore::HTMLMediaElement::didAddTextTrack):
(WebCore::HTMLMediaElement::scheduleConfigureTextTracks):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::scheduleMediaEngineWasUpdated):
(WebCore::HTMLMediaElement::mediaEngineWasUpdated):
(WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
(WebCore::HTMLMediaElement::scheduleUpdatePlayState):
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::setPlaying):
(WebCore::HTMLMediaElement::setPausedInternal):
(WebCore::HTMLMediaElement::cancelPendingTasks):
(WebCore::HTMLMediaElement::userCancelledLoad):
(WebCore::HTMLMediaElement::clearMediaPlayer):
(WebCore::HTMLMediaElement::contextDestroyed):
(WebCore::HTMLMediaElement::stop):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
(WebCore::HTMLMediaElement::dispatchEvent):
(WebCore::HTMLMediaElement::removeEventListener):
(WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
(WebCore::HTMLMediaElement::didBecomeFullscreenElement):
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured):
(WebCore::HTMLMediaElement::scheduleUpdateMediaState):
(WebCore::HTMLMediaElement::updateMediaState):
(WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
(WebCore::setFlags): Deleted.
(WebCore::clearFlags): Deleted.
(WebCore::actionName): Deleted.
(WebCore::HTMLMediaElement::scheduleDelayedAction): Deleted.
(WebCore::HTMLMediaElement::pendingActionTimerFired): Deleted.
* html/HTMLMediaElement.h:
* html/HTMLMediaElementEnums.h:
* platform/DeferrableTask.h: Added.
(WebCore::DeferrableTask::DeferrableTask):
(WebCore::DeferrableTask::scheduleTask):
(WebCore::DeferrableTask::close):
(WebCore::DeferrableTask::cancelTask):
(WebCore::DeferrableTask::hasPendingTask const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/wtf/LoggerHelper.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaElementEnums.h
Source/WebCore/platform/DeferrableTask.h [new file with mode: 0644]