Bug 1411808. P1 - run Update() loops off the main thread.
Note we will fix bugs required to run Update() off the main thread
in the following patches.
MozReview-Commit-ID: CYwT5kDjD9R
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -1169,17 +1169,17 @@ MediaCache::PredictNextUseForIncomingDat
int64_t millisecondsAhead = bytesAhead*1000/aStream->mPlaybackBytesPerSecond;
return TimeDuration::FromMilliseconds(
std::min<int64_t>(millisecondsAhead, INT32_MAX));
}
void
MediaCache::Update()
{
- NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
+ MOZ_ASSERT(sThread->IsOnCurrentThread());
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
struct StreamAction
{
enum
{
NONE,
@@ -1577,17 +1577,17 @@ MediaCache::QueueUpdate()
"Queuing an update while we're in an update");
if (mUpdateQueued)
return;
mUpdateQueued = true;
// XXX MediaCache does updates when decoders are still running at
// shutdown and get freed in the final cycle-collector cleanup. So
// don't leak a runnable in that case.
nsCOMPtr<nsIRunnable> event = new UpdateEvent(this);
- SystemGroup::Dispatch(TaskCategory::Other, event.forget());
+ sThread->Dispatch(event.forget());
}
void
MediaCache::QueueSuspendedStatusUpdate(int64_t aResourceID)
{
mReentrantMonitor.AssertCurrentThreadIn();
if (!mSuspendedStatusToNotify.Contains(aResourceID)) {
mSuspendedStatusToNotify.AppendElement(aResourceID);