Bug 1159558 - Redesign watching to use a manager. r=jww

This commit is contained in:
Bobby Holley
2015-04-28 19:02:31 -07:00
parent af73e74f6d
commit dc8cc8f105
8 changed files with 149 additions and 118 deletions

View File

@@ -217,6 +217,9 @@ public:
// Dispatch events
virtual nsresult DispatchAsyncEvent(const nsAString& aName) final override;
// Triggers a recomputation of readyState.
void UpdateReadyState() override { UpdateReadyStateInternal(); }
// Dispatch events that were raised while in the bfcache
nsresult DispatchPendingMediaEvents();
@@ -642,17 +645,7 @@ protected:
class StreamSizeListener;
MediaDecoderOwner::NextFrameStatus NextFrameStatus();
void SetDecoder(MediaDecoder* aDecoder)
{
if (mDecoder) {
mReadyStateUpdater->Unwatch(mDecoder->ReadyStateWatchTarget());
}
mDecoder = aDecoder;
if (mDecoder) {
mReadyStateUpdater->Watch(mDecoder->ReadyStateWatchTarget());
}
}
void SetDecoder(MediaDecoder* aDecoder) { mDecoder = aDecoder; }
virtual void GetItemValueText(DOMString& text) override;
virtual void SetItemValueText(const nsAString& text) override;
@@ -1032,6 +1025,9 @@ protected:
// At most one of mDecoder and mSrcStream can be non-null.
nsRefPtr<MediaDecoder> mDecoder;
// State-watching manager.
WatchManager<HTMLMediaElement> mWatchManager;
// A reference to the VideoFrameContainer which contains the current frame
// of video to display.
nsRefPtr<VideoFrameContainer> mVideoFrameContainer;
@@ -1102,8 +1098,6 @@ protected:
nsMediaNetworkState mNetworkState;
Watchable<nsMediaReadyState> mReadyState;
WatcherHolder mReadyStateUpdater;
enum LoadAlgorithmState {
// No load algorithm instance is waiting for a source to be added to the
// media in order to continue loading.