зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1159558 - Eliminate initial notifies. r=jww
They've proven themselves to be a hassle, and I think we can live without them.
This commit is contained in:
Родитель
e043d024f9
Коммит
b4659584c3
|
@ -267,8 +267,8 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
|
||||
// Skip the initial notification we get when we Watch the value, since we're
|
||||
// not on the right thread yet.
|
||||
mNextFrameStatusUpdater->Watch(mState, /* aSkipInitialNotify = */ true);
|
||||
mNextFrameStatusUpdater->Watch(mAudioCompleted, /* aSkipInitialNotify = */ true);
|
||||
mNextFrameStatusUpdater->Watch(mState);
|
||||
mNextFrameStatusUpdater->Watch(mAudioCompleted);
|
||||
mNextFrameStatusUpdater->AddWeakCallback(this, &MediaDecoderStateMachine::UpdateNextFrameStatus);
|
||||
|
||||
static bool sPrefCacheInit = false;
|
||||
|
|
|
@ -104,13 +104,10 @@ class WatchTarget
|
|||
public:
|
||||
explicit WatchTarget(const char* aName) : mName(aName) {}
|
||||
|
||||
void AddWatcher(AbstractWatcher* aWatcher, bool aSkipInitialNotify)
|
||||
void AddWatcher(AbstractWatcher* aWatcher)
|
||||
{
|
||||
MOZ_ASSERT(!mWatchers.Contains(aWatcher));
|
||||
mWatchers.AppendElement(aWatcher);
|
||||
if (!aSkipInitialNotify) {
|
||||
aWatcher->Notify();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveWatcher(AbstractWatcher* aWatcher)
|
||||
|
@ -206,7 +203,7 @@ public:
|
|||
AbstractThread::GetCurrent()->TailDispatcher().AddDirectTask(r.forget());
|
||||
}
|
||||
|
||||
void Watch(WatchTarget& aTarget, bool aSkipInitialNotify = false) { aTarget.AddWatcher(this, aSkipInitialNotify); }
|
||||
void Watch(WatchTarget& aTarget) { aTarget.AddWatcher(this); }
|
||||
void Unwatch(WatchTarget& aTarget) { aTarget.RemoveWatcher(this); }
|
||||
|
||||
template<typename ThisType>
|
||||
|
|
Загрузка…
Ссылка в новой задаче