bug 1198100 remove mNotificationMainThreadRunnable r=baku

If AddMainThreadListener() were called multiple times after
mFinishedNotificationSent is set then we'd get some extra NotifyRunnables but
NotifyMainThreadListeners() clears mMainThreadListeners anyway so we still get
only one notification per listener.

mNotificationMainThreadRunnable is an unnecessary optimization, so better not
to add storage to every MediaStream.

--HG--
extra : rebase_source : 7f0441d95134f1456058f668db30fb40bd9475c1
This commit is contained in:
Karl Tomlinson 2015-08-24 11:54:24 +12:00
Родитель 4a1f512a13
Коммит 7894dd5b6a
2 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -2383,9 +2383,8 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
mMainThreadListeners.AppendElement(aListener);
// If we have to send the notification or we have a runnable that will do it,
// let finish here.
if (!mFinishedNotificationSent || mNotificationMainThreadRunnable) {
// If it is not yet time to send the notification, then finish here.
if (!mFinishedNotificationSent) {
return;
}
@ -2399,7 +2398,6 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
NS_IMETHOD Run() override
{
MOZ_ASSERT(NS_IsMainThread());
mStream->mNotificationMainThreadRunnable = nullptr;
mStream->NotifyMainThreadListeners();
return NS_OK;
}
@ -2411,11 +2409,7 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
};
nsRefPtr<nsRunnable> runnable = new NotifyRunnable(this);
if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())))) {
return;
}
mNotificationMainThreadRunnable = runnable;
NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())));
}
void

Просмотреть файл

@ -638,7 +638,6 @@ protected:
TimeVarying<GraphTime,uint32_t,0> mExplicitBlockerCount;
nsTArray<nsRefPtr<MediaStreamListener> > mListeners;
nsTArray<MainThreadMediaStreamListener*> mMainThreadListeners;
nsRefPtr<nsRunnable> mNotificationMainThreadRunnable;
nsTArray<TrackID> mDisabledTrackIDs;
// Precomputed blocking status (over GraphTime).