Bug 1314833 - Part 2.2: Use AbstractThread::CreateDirectTaskDrainer() to Drain Direct Tasks Dispatched to MediaStreamGraph. f=rjesup,r=padenot,jwwang
MozReview-Commit-ID: 1KgE3uKu4CG
This commit is contained in:
@@ -4673,14 +4673,15 @@ class HTMLMediaElement::StreamListener : public MediaStreamListener,
|
||||
public WatchTarget
|
||||
{
|
||||
public:
|
||||
explicit StreamListener(HTMLMediaElement* aElement, const char* aName) :
|
||||
StreamListener(HTMLMediaElement* aElement, const char* aName) :
|
||||
WatchTarget(aName),
|
||||
mElement(aElement),
|
||||
mHaveCurrentData(false),
|
||||
mBlocked(false),
|
||||
mFinished(false),
|
||||
mMutex(aName),
|
||||
mPendingNotifyOutput(false)
|
||||
mPendingNotifyOutput(false),
|
||||
mAbstractMainThread(aElement->AbstractMainThread())
|
||||
{}
|
||||
void Forget()
|
||||
{
|
||||
@@ -4742,14 +4743,15 @@ public:
|
||||
} else {
|
||||
event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
|
||||
}
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(mAbstractMainThread,
|
||||
event.forget());
|
||||
}
|
||||
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph) override
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
|
||||
mAbstractMainThread,
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData));
|
||||
}
|
||||
virtual void NotifyOutput(MediaStreamGraph* aGraph,
|
||||
GraphTime aCurrentTime) override
|
||||
@@ -4758,9 +4760,9 @@ public:
|
||||
if (mPendingNotifyOutput)
|
||||
return;
|
||||
mPendingNotifyOutput = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyOutput);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
|
||||
mAbstractMainThread,
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyOutput));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -4773,6 +4775,7 @@ private:
|
||||
// mMutex protects the fields below; they can be accessed on any thread
|
||||
Mutex mMutex;
|
||||
bool mPendingNotifyOutput;
|
||||
const RefPtr<AbstractThread> mAbstractMainThread;
|
||||
};
|
||||
|
||||
class HTMLMediaElement::MediaStreamTracksAvailableCallback:
|
||||
|
||||
Reference in New Issue
Block a user