Bug 1344357 P3 - dont' pass dom::Promise into MediaDecoder anymore; r?jwwang
MozReview-Commit-ID: 5RUNauRRajP
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2719,17 +2719,17 @@ HTMLMediaElement::Seek(double aTime,
// this information as we don't yet control the demuxer for all
// MediaDecoderReaders.
mPlayingBeforeSeek = IsPotentiallyPlaying();
// The media backend is responsible for dispatching the timeupdate
// event if it changes the playback position as a result of the seek.
LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime));
- nsresult rv = mDecoder->Seek(aTime, aSeekType, promise);
+ nsresult rv = mDecoder->Seek(aTime, aSeekType);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
// We changed whether we're seeking so we need to AddRemoveSelfReference.
AddRemoveSelfReference();
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -22,17 +22,16 @@
#include "nsComponentManagerUtils.h"
#include <algorithm>
#include "MediaShutdownManager.h"
#include "AudioChannelService.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/dom/AudioTrack.h"
#include "mozilla/dom/AudioTrackList.h"
#include "mozilla/dom/HTMLMediaElement.h"
-#include "mozilla/dom/Promise.h"
#include "mozilla/dom/VideoTrack.h"
#include "mozilla/dom/VideoTrackList.h"
#include "nsPrintfCString.h"
#include "mozilla/Telemetry.h"
#include "Layers.h"
#include "mozilla/layers/ShadowLayers.h"
#ifdef MOZ_ANDROID_OMX
@@ -715,31 +714,30 @@ MediaDecoder::Play()
return NS_OK;
}
ChangeState(PLAY_STATE_PLAYING);
return NS_OK;
}
nsresult
-MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType,
- dom::Promise* aPromise /*=nullptr*/)
+MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value.");
int64_t timeUsecs = TimeUnit::FromSeconds(aTime).ToMicroseconds();
mLogicalPosition = aTime;
mLogicallySeeking = true;
SeekTarget target = SeekTarget(timeUsecs, aSeekType);
- CallSeek(target, aPromise);
+ CallSeek(target);
if (mPlayState == PLAY_STATE_ENDED) {
PinForSeek();
ChangeState(GetOwner()->GetPaused() ? PLAY_STATE_PAUSED : PLAY_STATE_PLAYING);
}
return NS_OK;
}
@@ -747,17 +745,17 @@ void
MediaDecoder::DiscardOngoingSeekIfExists()
{
MOZ_ASSERT(NS_IsMainThread());
mSeekRequest.DisconnectIfExists();
GetOwner()->AsyncRejectSeekDOMPromiseIfExists();
}
void
-MediaDecoder::CallSeek(const SeekTarget& aTarget, dom::Promise* aPromise)
+MediaDecoder::CallSeek(const SeekTarget& aTarget)
{
MOZ_ASSERT(NS_IsMainThread());
DiscardOngoingSeekIfExists();
mDecoderStateMachine->InvokeSeek(aTarget)
->Then(mAbstractMainThread, __func__, this,
&MediaDecoder::OnSeekResolved, &MediaDecoder::OnSeekRejected)
->Track(mSeekRequest);
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -36,17 +36,16 @@
#include "SeekTarget.h"
class nsIStreamListener;
class nsIPrincipal;
namespace mozilla {
namespace dom {
-class Promise;
class HTMLMediaElement;
}
class AbstractThread;
class VideoFrameContainer;
class MediaDecoderStateMachine;
enum class MediaEventType : int8_t;
@@ -174,18 +173,17 @@ public:
// Return the time position in the video stream being
// played measured in seconds.
virtual double GetCurrentTime();
// Seek to the time position in (seconds) from the start of the video.
// If aDoFastSeek is true, we'll seek to the sync point/keyframe preceeding
// the seek target.
- virtual nsresult Seek(double aTime, SeekTarget::Type aSeekType,
- dom::Promise* aPromise = nullptr);
+ virtual nsresult Seek(double aTime, SeekTarget::Type aSeekType);
// Initialize state machine and schedule it.
nsresult InitializeStateMachine();
// Start playback of a video. 'Load' must have previously been
// called.
virtual nsresult Play();
@@ -637,17 +635,17 @@ private:
RefPtr<ResourceCallback> mResourceCallback;
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
RefPtr<CDMProxyPromise> mCDMProxyPromise;
protected:
void DiscardOngoingSeekIfExists();
- virtual void CallSeek(const SeekTarget& aTarget, dom::Promise* aPromise);
+ virtual void CallSeek(const SeekTarget& aTarget);
MozPromiseRequestHolder<SeekPromise> mSeekRequest;
// True when seeking or otherwise moving the play position around in
// such a manner that progress event data is inaccurate. This is set
// during seek and duration operations to prevent the progress indicator
// from jumping around. Read/Write on the main thread only.
bool mIgnoreProgressData;