Bug 1314833 - Part 2.1: Factor out AbstractThread::MainThread() used in Media Playback. r=billm,jwwang

MozReview-Commit-ID: 9yJi3iDtVZG
This commit is contained in:
Bevis Tseng
2016-11-29 13:03:36 +08:00
parent ba2d99d8bb
commit 80ea683dc0
36 changed files with 196 additions and 63 deletions

View File

@@ -3573,7 +3573,8 @@ NS_IMPL_ISUPPORTS(HTMLMediaElement::ShutdownObserver, nsIObserver)
HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mWatchManager(this, AbstractThread::MainThread()),
mAbstractMainThread(OwnerDoc()->AbstractMainThreadFor(TaskCategory::Other)),
mWatchManager(this, mAbstractMainThread),
mSrcStreamTracksAvailable(false),
mSrcStreamPausedCurrentTime(-1),
mShutdownObserver(new ShutdownObserver),
@@ -4637,7 +4638,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
// Not every decoder will produce waitingForKey events, only add ones that can
if (waitingForKeyProducer) {
mWaitingForKeyListener = waitingForKeyProducer->Connect(
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
mAbstractMainThread, this, &HTMLMediaElement::CannotDecryptWaitingForKey);
}
if (mChannelLoader) {
@@ -7136,6 +7137,14 @@ HTMLMediaElement::UpdateCustomPolicyAfterPlayed()
}
}
AbstractThread*
HTMLMediaElement::AbstractMainThread() const
{
MOZ_ASSERT(mAbstractMainThread);
return mAbstractMainThread;
}
nsTArray<RefPtr<Promise>>
HTMLMediaElement::TakePendingPlayPromises()
{