diff --git a/dom/media/MediaDataDemuxer.h b/dom/media/MediaDataDemuxer.h index f58b3de6255b..4449d7359488 100644 --- a/dom/media/MediaDataDemuxer.h +++ b/dom/media/MediaDataDemuxer.h @@ -9,7 +9,7 @@ #include "MediaData.h" #include "MediaInfo.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "TimeUnits.h" #include "mozilla/UniquePtr.h" #include "nsISupportsImpl.h" @@ -40,7 +40,7 @@ class MediaDataDemuxer public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDemuxer) - typedef MediaPromise InitPromise; + typedef MozPromise InitPromise; // Initializes the demuxer. Other methods cannot be called unless // initialization has completed and succeeded. @@ -133,9 +133,9 @@ public: uint32_t mSkipped; }; - typedef MediaPromise SeekPromise; - typedef MediaPromise, DemuxerFailureReason, /* IsExclusive = */ true> SamplesPromise; - typedef MediaPromise SkipAccessPointPromise; + typedef MozPromise SeekPromise; + typedef MozPromise, DemuxerFailureReason, /* IsExclusive = */ true> SamplesPromise; + typedef MozPromise SkipAccessPointPromise; // Returns the TrackInfo (a.k.a Track Description) for this track. // The TrackInfo returned will be: diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index e70d36d73aea..c17c2f7375c4 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -121,7 +121,7 @@ public: StaticRefPtr MediaMemoryTracker::sUniqueInstance; PRLogModuleInfo* gStateWatchingLog; -PRLogModuleInfo* gMediaPromiseLog; +PRLogModuleInfo* gMozPromiseLog; PRLogModuleInfo* gMediaTimerLog; PRLogModuleInfo* gMediaSampleLog; @@ -134,7 +134,7 @@ MediaDecoder::InitStatics() // Log modules. gMediaDecoderLog = PR_NewLogModule("MediaDecoder"); - gMediaPromiseLog = PR_NewLogModule("MediaPromise"); + gMozPromiseLog = PR_NewLogModule("MozPromise"); gStateWatchingLog = PR_NewLogModule("StateWatching"); gMediaTimerLog = PR_NewLogModule("MediaTimer"); gMediaSampleLog = PR_NewLogModule("MediaSample"); diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 7621028476f4..8811a0a9cf68 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -189,7 +189,7 @@ destroying the MediaDecoder object. #include "nsIObserver.h" #include "nsAutoPtr.h" #include "nsITimer.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "MediaResource.h" #include "mozilla/dom/AudioChannelBinding.h" #include "mozilla/ReentrantMonitor.h" @@ -274,7 +274,7 @@ public: MediaDecoderEventVisibility mEventVisibility; }; - typedef MediaPromise SeekPromise; + typedef MozPromise SeekPromise; NS_DECL_THREADSAFE_ISUPPORTS @@ -986,7 +986,7 @@ protected: // Returns true if heuristic dormant is supported. bool IsHeuristicDormantSupported() const; - MediaPromiseRequestHolder mSeekRequest; + MozPromiseRequestHolder mSeekRequest; // True when seeking or otherwise moving the play position around in // such a manner that progress event data is inaccurate. This is set diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 2c725c220c85..5abcc6e76d1a 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -9,7 +9,7 @@ #include "AbstractMediaDecoder.h" #include "MediaInfo.h" #include "MediaData.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "MediaQueue.h" #include "MediaTimer.h" #include "AudioCompactor.h" @@ -66,16 +66,16 @@ public: CANCELED }; - typedef MediaPromise, ReadMetadataFailureReason, /* IsExclusive = */ true> MetadataPromise; - typedef MediaPromise, NotDecodedReason, /* IsExclusive = */ true> AudioDataPromise; - typedef MediaPromise, NotDecodedReason, /* IsExclusive = */ true> VideoDataPromise; - typedef MediaPromise SeekPromise; + typedef MozPromise, ReadMetadataFailureReason, /* IsExclusive = */ true> MetadataPromise; + typedef MozPromise, NotDecodedReason, /* IsExclusive = */ true> AudioDataPromise; + typedef MozPromise, NotDecodedReason, /* IsExclusive = */ true> VideoDataPromise; + typedef MozPromise SeekPromise; // Note that, conceptually, WaitForData makes sense in a non-exclusive sense. // But in the current architecture it's only ever used exclusively (by MDSM), // so we mark it that way to verify our assumptions. If you have a use-case // for multiple WaitForData consumers, feel free to flip the exclusivity here. - typedef MediaPromise WaitForDataPromise; + typedef MozPromise WaitForDataPromise; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader) @@ -386,7 +386,7 @@ protected: Mirror mDuration; // State for ThrottledNotifyDataArrived. - MediaPromiseRequestHolder mThrottledNotify; + MozPromiseRequestHolder mThrottledNotify; const TimeDuration mThrottleDuration; TimeStamp mLastThrottledNotify; Maybe> mThrottledInterval; @@ -420,8 +420,8 @@ protected: private: // Promises used only for the base-class (sync->async adapter) implementation // of Request{Audio,Video}Data. - MediaPromiseHolder mBaseAudioPromise; - MediaPromiseHolder mBaseVideoPromise; + MozPromiseHolder mBaseAudioPromise; + MozPromiseHolder mBaseVideoPromise; bool mTaskQueueIsBorrowed; diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 220cc61b9d64..417a9919725a 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -766,7 +766,7 @@ private: private: MediaDecoderStateMachine* mSelf; nsRefPtr mMediaTimer; - MediaPromiseRequestHolder mRequest; + MozPromiseRequestHolder mRequest; TimeStamp mTarget; } mDelayedScheduler; @@ -778,7 +778,7 @@ private: public: typedef MediaDecoderReader::AudioDataPromise AudioDataPromise; typedef MediaDecoderReader::VideoDataPromise VideoDataPromise; - typedef MediaPromise HaveStartTimePromise; + typedef MozPromise HaveStartTimePromise; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(StartTimeRendezvous); StartTimeRendezvous(AbstractThread* aOwnerThread, bool aHasAudio, bool aHasVideo, @@ -888,7 +888,7 @@ private: return aType == MediaData::AUDIO_DATA ? mAudioStartTime : mVideoStartTime; } - MediaPromiseHolder mHaveStartTimePromise; + MozPromiseHolder mHaveStartTimePromise; nsRefPtr mOwnerThread; Maybe mAudioStartTime; Maybe mVideoStartTime; @@ -999,7 +999,7 @@ private: } SeekTarget mTarget; - MediaPromiseHolder mPromise; + MozPromiseHolder mPromise; }; // Queued seek - moves to mPendingSeek when DecodeFirstFrame completes. @@ -1157,8 +1157,8 @@ private: // Only one of a given pair of ({Audio,Video}DataPromise, WaitForDataPromise) // should exist at any given moment. - MediaPromiseRequestHolder mAudioDataRequest; - MediaPromiseRequestHolder mAudioWaitRequest; + MozPromiseRequestHolder mAudioDataRequest; + MozPromiseRequestHolder mAudioWaitRequest; const char* AudioRequestStatus() { MOZ_ASSERT(OnTaskQueue()); @@ -1171,8 +1171,8 @@ private: return "idle"; } - MediaPromiseRequestHolder mVideoWaitRequest; - MediaPromiseRequestHolder mVideoDataRequest; + MozPromiseRequestHolder mVideoWaitRequest; + MozPromiseRequestHolder mVideoDataRequest; const char* VideoRequestStatus() { MOZ_ASSERT(OnTaskQueue()); @@ -1185,7 +1185,7 @@ private: return "idle"; } - MediaPromiseRequestHolder& WaitRequestRef(MediaData::Type aType) + MozPromiseRequestHolder& WaitRequestRef(MediaData::Type aType) { MOZ_ASSERT(OnTaskQueue()); return aType == MediaData::AUDIO_DATA ? mAudioWaitRequest : mVideoWaitRequest; @@ -1261,7 +1261,7 @@ private: bool mDecodeToSeekTarget; // Track the current seek promise made by the reader. - MediaPromiseRequestHolder mSeekRequest; + MozPromiseRequestHolder mSeekRequest; // We record the playback position before we seek in order to // determine where the seek terminated relative to the playback position @@ -1269,7 +1269,7 @@ private: int64_t mCurrentTimeBeforeSeek; // Track our request for metadata from the reader. - MediaPromiseRequestHolder mMetadataRequest; + MozPromiseRequestHolder mMetadataRequest; // Stores presentation info required for playback. The decoder monitor // must be held when accessing this. diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index 3aba953f2230..134af24ec422 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -227,12 +227,12 @@ private: bool mDiscontinuity; // Pending seek. - MediaPromiseRequestHolder mSeekRequest; + MozPromiseRequestHolder mSeekRequest; // Queued demux samples waiting to be decoded. nsTArray> mQueuedSamples; - MediaPromiseRequestHolder mDemuxRequest; - MediaPromiseHolder mWaitingPromise; + MozPromiseRequestHolder mDemuxRequest; + MozPromiseHolder mWaitingPromise; bool HasWaitingPromise() { MOZ_ASSERT(mOwner->OnTaskQueue()); @@ -308,7 +308,7 @@ private: DecoderData(aOwner, aType, aDecodeAhead) {} - MediaPromiseHolder mPromise; + MozPromiseHolder mPromise; bool HasPromise() override { @@ -335,7 +335,7 @@ private: // Demuxer objects. void OnDemuxerInitDone(nsresult); void OnDemuxerInitFailed(DemuxerFailureReason aFailure); - MediaPromiseRequestHolder mDemuxerInitRequest; + MozPromiseRequestHolder mDemuxerInitRequest; void OnDemuxFailed(TrackType aTrack, DemuxerFailureReason aFailure); void DoDemuxVideo(); @@ -353,7 +353,7 @@ private: } void SkipVideoDemuxToNextKeyFrame(media::TimeUnit aTimeThreshold); - MediaPromiseRequestHolder mSkipRequest; + MozPromiseRequestHolder mSkipRequest; void OnVideoSkipCompleted(uint32_t aSkipped); void OnVideoSkipFailed(MediaTrackDemuxer::SkipFailureHolder aFailure); @@ -368,7 +368,7 @@ private: // Metadata objects // True if we've read the streams' metadata. bool mInitDone; - MediaPromiseHolder mMetadataPromise; + MozPromiseHolder mMetadataPromise; // Accessed from multiple thread, in particular the MediaDecoderStateMachine, // however the value doesn't change after reading the metadata. bool mSeekable; @@ -404,7 +404,7 @@ private: } // Temporary seek information while we wait for the data Maybe mPendingSeekTime; - MediaPromiseHolder mSeekPromise; + MozPromiseHolder mSeekPromise; #ifdef MOZ_EME nsRefPtr mCDMProxy; diff --git a/dom/media/MediaTaskQueue.h b/dom/media/MediaTaskQueue.h index 25a641e92c4b..5371d5ff9211 100644 --- a/dom/media/MediaTaskQueue.h +++ b/dom/media/MediaTaskQueue.h @@ -13,7 +13,7 @@ #include "mozilla/unused.h" #include "SharedThreadPool.h" #include "nsThreadUtils.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "TaskDispatcher.h" class nsIRunnable; @@ -22,7 +22,7 @@ namespace mozilla { class SharedThreadPool; -typedef MediaPromise ShutdownPromise; +typedef MozPromise ShutdownPromise; // Abstracts executing runnables in order in a thread pool. The runnables // dispatched to the MediaTaskQueue will be executed in the order in which @@ -156,7 +156,7 @@ protected: // True if we've started our shutdown process. bool mIsShutdown; - MediaPromiseHolder mShutdownPromise; + MozPromiseHolder mShutdownPromise; // True if we're flushing; we reject new tasks if we're flushing. bool mIsFlushing; diff --git a/dom/media/MediaTimer.h b/dom/media/MediaTimer.h index 302320f1d04b..117a5e52088d 100644 --- a/dom/media/MediaTimer.h +++ b/dom/media/MediaTimer.h @@ -7,7 +7,7 @@ #if !defined(MediaTimer_h_) #define MediaTimer_h_ -#include "MediaPromise.h" +#include "MozPromise.h" #include @@ -28,11 +28,11 @@ extern PRLogModuleInfo* gMediaTimerLog; // This promise type is only exclusive because so far there isn't a reason for // it not to be. Feel free to change that. -typedef MediaPromise MediaTimerPromise; +typedef MozPromise MediaTimerPromise; // Timers only know how to fire at a given thread, which creates an impedence // mismatch with code that operates with MediaTaskQueues. This class solves -// that mismatch with a dedicated (but shared) thread and a nice MediaPromise-y +// that mismatch with a dedicated (but shared) thread and a nice MozPromise-y // interface. class MediaTimer { diff --git a/dom/media/MediaPromise.h b/dom/media/MozPromise.h similarity index 86% rename from dom/media/MediaPromise.h rename to dom/media/MozPromise.h index 5eff7d589730..86fcfb030008 100644 --- a/dom/media/MediaPromise.h +++ b/dom/media/MozPromise.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if !defined(MediaPromise_h_) -#define MediaPromise_h_ +#if !defined(MozPromise_h_) +#define MozPromise_h_ #include "mozilla/Logging.h" @@ -20,18 +20,18 @@ #include "mozilla/Monitor.h" #include "mozilla/unused.h" -/* Polyfill __func__ on MSVC for consumers to pass to the MediaPromise API. */ +/* Polyfill __func__ on MSVC for consumers to pass to the MozPromise API. */ #ifdef _MSC_VER #define __func__ __FUNCTION__ #endif namespace mozilla { -extern PRLogModuleInfo* gMediaPromiseLog; +extern PRLogModuleInfo* gMozPromiseLog; #define PROMISE_LOG(x, ...) \ - MOZ_ASSERT(gMediaPromiseLog); \ - MOZ_LOG(gMediaPromiseLog, mozilla::LogLevel::Debug, (x, ##__VA_ARGS__)) + MOZ_ASSERT(gMozPromiseLog); \ + MOZ_LOG(gMozPromiseLog, mozilla::LogLevel::Debug, (x, ##__VA_ARGS__)) namespace detail { template @@ -75,14 +75,14 @@ struct ReturnTypeIs { * callbacks to be invoked (asynchronously, on a specified thread) when the * request is either completed (resolved) or cannot be completed (rejected). * - * MediaPromises attempt to mirror the spirit of JS Promises to the extent that - * is possible (and desirable) in C++. While the intent is that MediaPromises + * MozPromises attempt to mirror the spirit of JS Promises to the extent that + * is possible (and desirable) in C++. While the intent is that MozPromises * feel familiar to programmers who are accustomed to their JS-implemented cousin, * we don't shy away from imposing restrictions and adding features that make * sense for the use cases we encounter. * - * A MediaPromise is ThreadSafe, and may be ->Then()ed on any thread. The Then() - * call accepts resolve and reject callbacks, and returns a MediaPromise::Request. + * A MozPromise is ThreadSafe, and may be ->Then()ed on any thread. The Then() + * call accepts resolve and reject callbacks, and returns a MozPromise::Request. * The Request object serves several purposes for the consumer. * * (1) It allows the caller to cancel the delivery of the resolve/reject value @@ -91,33 +91,33 @@ struct ReturnTypeIs { * * (2) It provides access to a "Completion Promise", which is roughly analagous * to the Promise returned directly by ->then() calls on JS promises. If - * the resolve/reject callback returns a new MediaPromise, that promise is + * the resolve/reject callback returns a new MozPromise, that promise is * chained to the completion promise, such that its resolve/reject value * will be forwarded along when it arrives. If the resolve/reject callback * returns void, the completion promise is resolved/rejected with the same * value that was passed to the callback. * - * The MediaPromise APIs skirt traditional XPCOM convention by returning nsRefPtrs + * The MozPromise APIs skirt traditional XPCOM convention by returning nsRefPtrs * (rather than already_AddRefed) from various methods. This is done to allow elegant * chaining of calls without cluttering up the code with intermediate variables, and * without introducing separate API variants for callers that want a return value * (from, say, ->Then()) from those that don't. * - * When IsExclusive is true, the MediaPromise does a release-mode assertion that + * When IsExclusive is true, the MozPromise does a release-mode assertion that * there is at most one call to either Then(...) or ChainTo(...). */ -class MediaPromiseRefcountable +class MozPromiseRefcountable { public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPromiseRefcountable) + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MozPromiseRefcountable) protected: - virtual ~MediaPromiseRefcountable() {} + virtual ~MozPromiseRefcountable() {} }; -template class MediaPromiseHolder; +template class MozPromiseHolder; template -class MediaPromise : public MediaPromiseRefcountable +class MozPromise : public MozPromiseRefcountable { public: typedef ResolveValueT ResolveValueType; @@ -168,47 +168,47 @@ public: }; protected: - // MediaPromise is the public type, and never constructed directly. Construct - // a MediaPromise::Private, defined below. - explicit MediaPromise(const char* aCreationSite) + // MozPromise is the public type, and never constructed directly. Construct + // a MozPromise::Private, defined below. + explicit MozPromise(const char* aCreationSite) : mCreationSite(aCreationSite) - , mMutex("MediaPromise Mutex") + , mMutex("MozPromise Mutex") , mHaveRequest(false) { - PROMISE_LOG("%s creating MediaPromise (%p)", mCreationSite, this); + PROMISE_LOG("%s creating MozPromise (%p)", mCreationSite, this); } public: - // MediaPromise::Private allows us to separate the public interface (upon which + // MozPromise::Private allows us to separate the public interface (upon which // consumers of the promise may invoke methods like Then()) from the private // interface (upon which the creator of the promise may invoke Resolve() or - // Reject()). APIs should create and store a MediaPromise::Private (usually - // via a MediaPromiseHolder), and return a MediaPromise to consumers. + // Reject()). APIs should create and store a MozPromise::Private (usually + // via a MozPromiseHolder), and return a MozPromise to consumers. // // NB: We can include the definition of this class inline once B2G ICS is gone. class Private; template - static nsRefPtr + static nsRefPtr CreateAndResolve(ResolveValueType_&& aResolveValue, const char* aResolveSite) { - nsRefPtr p = new MediaPromise::Private(aResolveSite); + nsRefPtr p = new MozPromise::Private(aResolveSite); p->Resolve(Forward(aResolveValue), aResolveSite); return p.forget(); } template - static nsRefPtr + static nsRefPtr CreateAndReject(RejectValueType_&& aRejectValue, const char* aRejectSite) { - nsRefPtr p = new MediaPromise::Private(aRejectSite); + nsRefPtr p = new MozPromise::Private(aRejectSite); p->Reject(Forward(aRejectValue), aRejectSite); return p.forget(); } - typedef MediaPromise, RejectValueType, IsExclusive> AllPromiseType; + typedef MozPromise, RejectValueType, IsExclusive> AllPromiseType; private: - class AllPromiseHolder : public MediaPromiseRefcountable + class AllPromiseHolder : public MozPromiseRefcountable { public: explicit AllPromiseHolder(size_t aDependentPromises) @@ -255,7 +255,7 @@ private: }; public: - static nsRefPtr All(AbstractThread* aProcessingThread, nsTArray>& aPromises) + static nsRefPtr All(AbstractThread* aProcessingThread, nsTArray>& aPromises) { nsRefPtr holder = new AllPromiseHolder(aPromises.Length()); for (size_t i = 0; i < aPromises.Length(); ++i) { @@ -267,7 +267,7 @@ public: return holder->Promise(); } - class Request : public MediaPromiseRefcountable + class Request : public MozPromiseRefcountable { public: virtual void Disconnect() = 0; @@ -276,7 +276,7 @@ public: // tries to access an inherited protected member. bool IsDisconnected() const { return mDisconnected; } - virtual MediaPromise* CompletionPromise() = 0; + virtual MozPromise* CompletionPromise() = 0; protected: Request() : mComplete(false), mDisconnected(false) {} @@ -300,7 +300,7 @@ protected: class ResolveOrRejectRunnable : public nsRunnable { public: - ResolveOrRejectRunnable(ThenValueBase* aThenValue, MediaPromise* aPromise) + ResolveOrRejectRunnable(ThenValueBase* aThenValue, MozPromise* aPromise) : mThenValue(aThenValue) , mPromise(aPromise) { @@ -323,23 +323,23 @@ protected: private: nsRefPtr mThenValue; - nsRefPtr mPromise; + nsRefPtr mPromise; }; explicit ThenValueBase(AbstractThread* aResponseTarget, const char* aCallSite) : mResponseTarget(aResponseTarget), mCallSite(aCallSite) {} - MediaPromise* CompletionPromise() override + MozPromise* CompletionPromise() override { MOZ_DIAGNOSTIC_ASSERT(mResponseTarget->IsCurrentThreadIn()); MOZ_DIAGNOSTIC_ASSERT(!Request::mComplete); if (!mCompletionPromise) { - mCompletionPromise = new MediaPromise::Private(""); + mCompletionPromise = new MozPromise::Private(""); } return mCompletionPromise; } - void Dispatch(MediaPromise *aPromise) + void Dispatch(MozPromise *aPromise) { aPromise->mMutex.AssertCurrentThreadOwns(); MOZ_ASSERT(!aPromise->IsPending()); @@ -371,7 +371,7 @@ protected: } protected: - virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) = 0; + virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) = 0; void DoResolveOrReject(const ResolveOrRejectValue& aValue) { @@ -382,16 +382,16 @@ protected: } // Invoke the resolve or reject method. - nsRefPtr p = DoResolveOrRejectInternal(aValue); + nsRefPtr p = DoResolveOrRejectInternal(aValue); // If there's a completion promise, resolve it appropriately with the // result of the method. // - // We jump through some hoops to cast to MediaPromise::Private here. This + // We jump through some hoops to cast to MozPromise::Private here. This // can go away when we can just declare mCompletionPromise as - // MediaPromise::Private. See the declaration below. - nsRefPtr completionPromise = - dont_AddRef(static_cast(mCompletionPromise.forget().take())); + // MozPromise::Private. See the declaration below. + nsRefPtr completionPromise = + dont_AddRef(static_cast(mCompletionPromise.forget().take())); if (completionPromise) { if (p) { p->ChainTo(completionPromise.forget(), ""); @@ -403,11 +403,11 @@ protected: nsRefPtr mResponseTarget; // May be released on any thread. - // Declaring nsRefPtr here causes build failures - // on MSVC because MediaPromise::Private is only forward-declared at this - // point. This hack can go away when we inline-declare MediaPromise::Private, + // Declaring nsRefPtr here causes build failures + // on MSVC because MozPromise::Private is only forward-declared at this + // point. This hack can go away when we inline-declare MozPromise::Private, // which is blocked on the B2G ICS compiler being too old. - nsRefPtr mCompletionPromise; + nsRefPtr mCompletionPromise; const char* mCallSite; }; @@ -418,9 +418,9 @@ protected: */ template - static typename EnableIf>::value && + static typename EnableIf>::value && TakesArgument::value, - already_AddRefed>::Type + already_AddRefed>::Type InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue) { return ((*aThisVal).*aMethod)(Forward(aValue)).forget(); @@ -429,7 +429,7 @@ protected: template static typename EnableIf::value && TakesArgument::value, - already_AddRefed>::Type + already_AddRefed>::Type InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue) { ((*aThisVal).*aMethod)(Forward(aValue)); @@ -437,9 +437,9 @@ protected: } template - static typename EnableIf>::value && + static typename EnableIf>::value && !TakesArgument::value, - already_AddRefed>::Type + already_AddRefed>::Type InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue) { return ((*aThisVal).*aMethod)().forget(); @@ -448,7 +448,7 @@ protected: template static typename EnableIf::value && !TakesArgument::value, - already_AddRefed>::Type + already_AddRefed>::Type InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue) { ((*aThisVal).*aMethod)(); @@ -478,9 +478,9 @@ protected: } protected: - virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override + virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override { - nsRefPtr completion; + nsRefPtr completion; if (aValue.IsResolve()) { completion = InvokeCallbackMethod(mThisVal.get(), mResolveMethod, aValue.ResolveValue()); } else { @@ -530,14 +530,14 @@ protected: } protected: - virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override + virtual already_AddRefed DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override { // Note: The usage of InvokeCallbackMethod here requires that // ResolveFunction/RejectFunction are capture-lambdas (i.e. anonymous // classes with ::operator()), since it allows us to share code more easily. // We could fix this if need be, though it's quite easy to work around by // just capturing something. - nsRefPtr completion; + nsRefPtr completion; if (aValue.IsResolve()) { completion = InvokeCallbackMethod(mResolveFunction.ptr(), &ResolveFunction::operator(), aValue.ResolveValue()); } else { @@ -647,9 +647,9 @@ protected: } } - virtual ~MediaPromise() + virtual ~MozPromise() { - PROMISE_LOG("MediaPromise::~MediaPromise [this=%p]", this); + PROMISE_LOG("MozPromise::~MozPromise [this=%p]", this); MOZ_ASSERT(!IsPending()); MOZ_ASSERT(mThenValues.IsEmpty()); MOZ_ASSERT(mChainedPromises.IsEmpty()); @@ -664,18 +664,18 @@ protected: }; template -class MediaPromise::Private - : public MediaPromise +class MozPromise::Private + : public MozPromise { public: - explicit Private(const char* aCreationSite) : MediaPromise(aCreationSite) {} + explicit Private(const char* aCreationSite) : MozPromise(aCreationSite) {} template void Resolve(ResolveValueT_&& aResolveValue, const char* aResolveSite) { MutexAutoLock lock(mMutex); MOZ_ASSERT(IsPending()); - PROMISE_LOG("%s resolving MediaPromise (%p created at %s)", aResolveSite, this, mCreationSite); + PROMISE_LOG("%s resolving MozPromise (%p created at %s)", aResolveSite, this, mCreationSite); mValue.SetResolve(Forward(aResolveValue)); DispatchAll(); } @@ -685,7 +685,7 @@ public: { MutexAutoLock lock(mMutex); MOZ_ASSERT(IsPending()); - PROMISE_LOG("%s rejecting MediaPromise (%p created at %s)", aRejectSite, this, mCreationSite); + PROMISE_LOG("%s rejecting MozPromise (%p created at %s)", aRejectSite, this, mCreationSite); mValue.SetReject(Forward(aRejectValue)); DispatchAll(); } @@ -695,28 +695,28 @@ public: { MutexAutoLock lock(mMutex); MOZ_ASSERT(IsPending()); - PROMISE_LOG("%s resolveOrRejecting MediaPromise (%p created at %s)", aSite, this, mCreationSite); + PROMISE_LOG("%s resolveOrRejecting MozPromise (%p created at %s)", aSite, this, mCreationSite); mValue = Forward(aValue); DispatchAll(); } }; // A generic promise type that does the trick for simple use cases. -typedef MediaPromise GenericPromise; +typedef MozPromise GenericPromise; /* * Class to encapsulate a promise for a particular role. Use this as the member * variable for a class whose method returns a promise. */ template -class MediaPromiseHolder +class MozPromiseHolder { public: - MediaPromiseHolder() + MozPromiseHolder() : mMonitor(nullptr) {} // Move semantics. - MediaPromiseHolder& operator=(MediaPromiseHolder&& aOther) + MozPromiseHolder& operator=(MozPromiseHolder&& aOther) { MOZ_ASSERT(!mMonitor && !aOther.mMonitor); MOZ_DIAGNOSTIC_ASSERT(!mPromise); @@ -725,7 +725,7 @@ public: return *this; } - ~MediaPromiseHolder() { MOZ_ASSERT(!mPromise); } + ~MozPromiseHolder() { MOZ_ASSERT(!mPromise); } already_AddRefed Ensure(const char* aMethodName) { if (mMonitor) { @@ -806,15 +806,15 @@ private: }; /* - * Class to encapsulate a MediaPromise::Request reference. Use this as the member - * variable for a class waiting on a media promise. + * Class to encapsulate a MozPromise::Request reference. Use this as the member + * variable for a class waiting on a MozPromise. */ template -class MediaPromiseRequestHolder +class MozPromiseRequestHolder { public: - MediaPromiseRequestHolder() {} - ~MediaPromiseRequestHolder() { MOZ_ASSERT(!mRequest); } + MozPromiseRequestHolder() {} + ~MozPromiseRequestHolder() { MOZ_ASSERT(!mRequest); } void Begin(typename PromiseType::Request* aRequest) { diff --git a/dom/media/StateMirroring.h b/dom/media/StateMirroring.h index 7929958492c3..c9a51c0716d1 100644 --- a/dom/media/StateMirroring.h +++ b/dom/media/StateMirroring.h @@ -7,7 +7,7 @@ #if !defined(StateMirroring_h_) #define StateMirroring_h_ -#include "MediaPromise.h" +#include "MozPromise.h" #include "StateWatching.h" #include "TaskDispatcher.h" diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index e810989bcb55..e2274302ed5b 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -13,7 +13,7 @@ #include "nsIThread.h" #include "nsSize.h" #include "nsRect.h" -#include "MediaPromise.h" +#include "MozPromise.h" #if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \ defined(MOZ_ASAN) @@ -215,7 +215,7 @@ class SharedThreadPool; // wait on tasks in the PLAYBACK thread pool. // // No new dependencies on this mechanism should be added, as methods are being -// made async supported by MediaPromise, making this unnecessary and +// made async supported by MozPromise, making this unnecessary and // permitting unifying the pool. enum class MediaThreadType { PLAYBACK, // MediaDecoderStateMachine and MediaDecoderReader diff --git a/dom/media/android/AndroidMediaReader.h b/dom/media/android/AndroidMediaReader.h index 408fa04bbd5b..3d3c8591edad 100644 --- a/dom/media/android/AndroidMediaReader.h +++ b/dom/media/android/AndroidMediaReader.h @@ -36,8 +36,8 @@ class AndroidMediaReader : public MediaDecoderReader int64_t mVideoSeekTimeUs; int64_t mAudioSeekTimeUs; nsRefPtr mLastVideoFrame; - MediaPromiseHolder mSeekPromise; - MediaPromiseRequestHolder mSeekRequest; + MozPromiseHolder mSeekPromise; + MozPromiseRequestHolder mSeekRequest; public: AndroidMediaReader(AbstractMediaDecoder* aDecoder, const nsACString& aContentType); diff --git a/dom/media/eme/CDMProxy.h b/dom/media/eme/CDMProxy.h index e05640e2c38e..e76a1df040e3 100644 --- a/dom/media/eme/CDMProxy.h +++ b/dom/media/eme/CDMProxy.h @@ -14,7 +14,7 @@ #include "nsIThread.h" #include "GMPDecryptorProxy.h" #include "mozilla/CDMCaps.h" -#include "MediaPromise.h" +#include "MozPromise.h" namespace mozilla { class MediaRawData; @@ -44,7 +44,7 @@ public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CDMProxy) - typedef MediaPromise DecryptPromise; + typedef MozPromise DecryptPromise; // Main thread only. CDMProxy(dom::MediaKeys* aKeys, const nsAString& aKeySystem); @@ -259,7 +259,7 @@ private: nsRefPtr mSample; private: ~DecryptJob() {} - MediaPromiseHolder mPromise; + MozPromiseHolder mPromise; }; // GMP thread only. void gmp_Decrypt(nsRefPtr aJob); diff --git a/dom/media/fmp4/MP4Reader.h b/dom/media/fmp4/MP4Reader.h index 86af7729ba8d..32d1617a8028 100644 --- a/dom/media/fmp4/MP4Reader.h +++ b/dom/media/fmp4/MP4Reader.h @@ -224,7 +224,7 @@ private: mPromise.SetMonitor(&mMonitor); } - MediaPromiseHolder mPromise; + MozPromiseHolder mPromise; bool HasPromise() override { return !mPromise.IsEmpty(); } void RejectPromise(MediaDecoderReader::NotDecodedReason aReason, diff --git a/dom/media/gtest/TestMediaPromise.cpp b/dom/media/gtest/TestMozPromise.cpp similarity index 95% rename from dom/media/gtest/TestMediaPromise.cpp rename to dom/media/gtest/TestMozPromise.cpp index 265bb7a9468f..530391c0f872 100644 --- a/dom/media/gtest/TestMediaPromise.cpp +++ b/dom/media/gtest/TestMozPromise.cpp @@ -6,13 +6,13 @@ #include "gtest/gtest.h" #include "nsISupportsImpl.h" #include "MediaTaskQueue.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "SharedThreadPool.h" #include "VideoUtils.h" using namespace mozilla; -typedef MediaPromise TestPromise; +typedef MozPromise TestPromise; typedef TestPromise::ResolveOrRejectValue RRValue; class MOZ_STACK_CLASS AutoTaskQueue @@ -88,7 +88,7 @@ RunOnTaskQueue(MediaTaskQueue* aQueue, FunctionType aFun) // std::function can't come soon enough. :-( #define DO_FAIL []()->void { EXPECT_TRUE(false); } -TEST(MediaPromise, BasicResolve) +TEST(MozPromise, BasicResolve) { AutoTaskQueue atq; nsRefPtr queue = atq.TaskQueue(); @@ -99,7 +99,7 @@ TEST(MediaPromise, BasicResolve) }); } -TEST(MediaPromise, BasicReject) +TEST(MozPromise, BasicReject) { AutoTaskQueue atq; nsRefPtr queue = atq.TaskQueue(); @@ -110,7 +110,7 @@ TEST(MediaPromise, BasicReject) }); } -TEST(MediaPromise, AsyncResolve) +TEST(MozPromise, AsyncResolve) { AutoTaskQueue atq; nsRefPtr queue = atq.TaskQueue(); @@ -139,7 +139,7 @@ TEST(MediaPromise, AsyncResolve) }); } -TEST(MediaPromise, CompletionPromises) +TEST(MozPromise, CompletionPromises) { bool invokedPass = false; AutoTaskQueue atq; @@ -171,7 +171,7 @@ TEST(MediaPromise, CompletionPromises) }); } -TEST(MediaPromise, PromiseAllResolve) +TEST(MozPromise, PromiseAllResolve) { AutoTaskQueue atq; nsRefPtr queue = atq.TaskQueue(); @@ -195,7 +195,7 @@ TEST(MediaPromise, PromiseAllResolve) }); } -TEST(MediaPromise, PromiseAllReject) +TEST(MozPromise, PromiseAllReject) { AutoTaskQueue atq; nsRefPtr queue = atq.TaskQueue(); diff --git a/dom/media/gtest/moz.build b/dom/media/gtest/moz.build index 551a3430e89f..2e8db6947801 100644 --- a/dom/media/gtest/moz.build +++ b/dom/media/gtest/moz.build @@ -10,7 +10,7 @@ UNIFIED_SOURCES += [ 'TestGMPCrossOrigin.cpp', 'TestGMPRemoveAndDelete.cpp', 'TestIntervalSet.cpp', - 'TestMediaPromise.cpp', + 'TestMozPromise.cpp', 'TestMP3Demuxer.cpp', 'TestMP4Demuxer.cpp', # 'TestMP4Reader.cpp', disabled so we can turn check tests back on (bug 1175752) diff --git a/dom/media/mediasource/MediaSourceReader.h b/dom/media/mediasource/MediaSourceReader.h index 500290764385..bc5e82d42983 100644 --- a/dom/media/mediasource/MediaSourceReader.h +++ b/dom/media/mediasource/MediaSourceReader.h @@ -206,7 +206,7 @@ private: int64_t GetReaderAudioTime(int64_t aTime) const; int64_t GetReaderVideoTime(int64_t aTime) const; - // Will reject the MediaPromise with END_OF_STREAM if mediasource has ended + // Will reject the MozPromise with END_OF_STREAM if mediasource has ended // or with WAIT_FOR_DATA otherwise. void CheckForWaitOrEndOfStream(MediaData::Type aType, int64_t aTime /* microseconds */); @@ -234,15 +234,15 @@ private: nsRefPtr mAudioTrack; nsRefPtr mVideoTrack; - MediaPromiseRequestHolder mAudioRequest; - MediaPromiseRequestHolder mVideoRequest; + MozPromiseRequestHolder mAudioRequest; + MozPromiseRequestHolder mVideoRequest; - MediaPromiseHolder mAudioPromise; - MediaPromiseHolder mVideoPromise; + MozPromiseHolder mAudioPromise; + MozPromiseHolder mVideoPromise; - MediaPromiseHolder mAudioWaitPromise; - MediaPromiseHolder mVideoWaitPromise; - MediaPromiseHolder& WaitPromise(MediaData::Type aType) + MozPromiseHolder mAudioWaitPromise; + MozPromiseHolder mVideoWaitPromise; + MozPromiseHolder& WaitPromise(MediaData::Type aType) { return aType == MediaData::AUDIO_DATA ? mAudioWaitPromise : mVideoWaitPromise; } @@ -257,9 +257,9 @@ private: bool mForceVideoDecodeAhead; - MediaPromiseRequestHolder mAudioSeekRequest; - MediaPromiseRequestHolder mVideoSeekRequest; - MediaPromiseHolder mSeekPromise; + MozPromiseRequestHolder mAudioSeekRequest; + MozPromiseRequestHolder mVideoSeekRequest; + MozPromiseHolder mSeekPromise; // Temporary seek information while we wait for the data // to be added to the track buffer. @@ -281,7 +281,7 @@ private: bool mHasEssentialTrackBuffers; void ContinueShutdown(); - MediaPromiseHolder mMediaSourceShutdownPromise; + MozPromiseHolder mMediaSourceShutdownPromise; #ifdef MOZ_FMP4 nsRefPtr mSharedDecoderManager; #endif diff --git a/dom/media/mediasource/SourceBuffer.h b/dom/media/mediasource/SourceBuffer.h index aa3d387b748e..fd47270e93ac 100644 --- a/dom/media/mediasource/SourceBuffer.h +++ b/dom/media/mediasource/SourceBuffer.h @@ -7,7 +7,7 @@ #ifndef mozilla_dom_SourceBuffer_h_ #define mozilla_dom_SourceBuffer_h_ -#include "MediaPromise.h" +#include "MozPromise.h" #include "MediaSource.h" #include "js/RootingAPI.h" #include "mozilla/Assertions.h" @@ -195,7 +195,7 @@ private: uint32_t mUpdateID; int64_t mReportedOffset; - MediaPromiseRequestHolder mPendingAppend; + MozPromiseRequestHolder mPendingAppend; const nsCString mType; }; diff --git a/dom/media/mediasource/SourceBufferContentManager.h b/dom/media/mediasource/SourceBufferContentManager.h index 9f6f526a2750..dff423b4e119 100644 --- a/dom/media/mediasource/SourceBufferContentManager.h +++ b/dom/media/mediasource/SourceBufferContentManager.h @@ -8,7 +8,7 @@ #define MOZILLA_SOURCEBUFFERCONTENTMANAGER_H_ #include "MediaData.h" -#include "MediaPromise.h" +#include "MozPromise.h" #include "MediaSourceDecoder.h" #include "SourceBuffer.h" #include "TimeUnits.h" @@ -23,7 +23,7 @@ class SourceBufferContentManager { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SourceBufferContentManager); - typedef MediaPromise AppendPromise; + typedef MozPromise AppendPromise; typedef AppendPromise RangeRemovalPromise; static already_AddRefed diff --git a/dom/media/mediasource/TrackBuffer.cpp b/dom/media/mediasource/TrackBuffer.cpp index f6ca03cc675e..5c2949c1c738 100644 --- a/dom/media/mediasource/TrackBuffer.cpp +++ b/dom/media/mediasource/TrackBuffer.cpp @@ -1093,7 +1093,7 @@ TrackBuffer::AbortAppendData() RemoveDecoder(current); } // The SourceBuffer would have disconnected its promise. - // However we must ensure that the MediaPromiseHolder handle all pending + // However we must ensure that the MozPromiseHolder handle all pending // promises. mInitializationPromise.RejectIfExists(NS_ERROR_ABORT, __func__); } diff --git a/dom/media/mediasource/TrackBuffer.h b/dom/media/mediasource/TrackBuffer.h index 75ba114bdf5b..f7bf11eeb39a 100644 --- a/dom/media/mediasource/TrackBuffer.h +++ b/dom/media/mediasource/TrackBuffer.h @@ -138,7 +138,7 @@ private: // Queue on the parent's decoder task queue a call to NotifyDataRemoved. void NotifyReaderDataRemoved(MediaDecoderReader* aReader); - typedef MediaPromise BufferedRangesUpdatedPromise; + typedef MozPromise BufferedRangesUpdatedPromise; nsRefPtr UpdateBufferedRanges(Interval aByteRange, bool aNotifyParent); // Queue execution of InitializeDecoder on mTaskQueue. @@ -226,15 +226,15 @@ private: MediaInfo mInfo; void ContinueShutdown(); - MediaPromiseHolder mShutdownPromise; + MozPromiseHolder mShutdownPromise; bool mDecoderPerSegment; bool mShutdown; - MediaPromiseHolder mInitializationPromise; + MozPromiseHolder mInitializationPromise; // Track our request for metadata from the reader. - MediaPromiseRequestHolder mMetadataRequest; + MozPromiseRequestHolder mMetadataRequest; - MediaPromiseHolder mRangeRemovalPromise; + MozPromiseHolder mRangeRemovalPromise; Interval mLastAppendRange; diff --git a/dom/media/mediasource/TrackBuffersManager.h b/dom/media/mediasource/TrackBuffersManager.h index 22f0feba69bb..6b10eb084f39 100644 --- a/dom/media/mediasource/TrackBuffersManager.h +++ b/dom/media/mediasource/TrackBuffersManager.h @@ -34,7 +34,7 @@ using dom::SourceBufferAppendMode; class TrackBuffersManager : public SourceBufferContentManager { public: - typedef MediaPromise CodedFrameProcessingPromise; + typedef MozPromise CodedFrameProcessingPromise; typedef TrackInfo::TrackType TrackType; typedef MediaData::Type MediaType; typedef nsTArray> TrackBuffer; @@ -166,7 +166,7 @@ private: void OnDemuxerInitDone(nsresult); void OnDemuxerInitFailed(DemuxerFailureReason aFailure); - MediaPromiseRequestHolder mDemuxerInitRequest; + MozPromiseRequestHolder mDemuxerInitRequest; bool mEncrypted; void OnDemuxFailed(TrackType aTrack, DemuxerFailureReason aFailure); @@ -221,7 +221,7 @@ private: // buffer. bool mNeedRandomAccessPoint; nsRefPtr mDemuxer; - MediaPromiseRequestHolder mDemuxRequest; + MozPromiseRequestHolder mDemuxRequest; // If set, position where the next contiguous frame will be inserted. // If a discontinuity is detected, it will be unset and recalculated upon // the next insertion. @@ -272,10 +272,10 @@ private: void UpdateBufferedRanges(); void RejectProcessing(nsresult aRejectValue, const char* aName); void ResolveProcessing(bool aResolveValue, const char* aName); - MediaPromiseRequestHolder mProcessingRequest; - MediaPromiseHolder mProcessingPromise; + MozPromiseRequestHolder mProcessingRequest; + MozPromiseHolder mProcessingPromise; - MediaPromiseHolder mAppendPromise; + MozPromiseHolder mAppendPromise; // Set to true while SegmentParserLoop is running. This is used for diagnostic // purposes only. We can't rely on mAppendPromise to be empty as it is only // cleared in a follow up task. diff --git a/dom/media/moz.build b/dom/media/moz.build index f7a009694a73..4ed5ee3973dd 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -124,7 +124,6 @@ EXPORTS += [ 'MediaFormatReader.h', 'MediaInfo.h', 'MediaMetadataManager.h', - 'MediaPromise.h', 'MediaQueue.h', 'MediaRecorder.h', 'MediaResource.h', @@ -134,6 +133,7 @@ EXPORTS += [ 'MediaTimer.h', 'MediaTrack.h', 'MediaTrackList.h', + 'MozPromise.h', 'MP3Decoder.h', 'MP3Demuxer.h', 'MP3FrameParser.h', diff --git a/dom/media/omx/AudioOffloadPlayer.h b/dom/media/omx/AudioOffloadPlayer.h index 2ee3f454b84b..71b89a3ae013 100644 --- a/dom/media/omx/AudioOffloadPlayer.h +++ b/dom/media/omx/AudioOffloadPlayer.h @@ -146,10 +146,10 @@ private: // mLock SeekTarget mSeekTarget; - // MediaPromise of current seek. + // MozPromise of current seek. // Used in main thread and offload callback thread, protected by Mutex // mLock - MediaPromiseHolder mSeekPromise; + MozPromiseHolder mSeekPromise; // Positions obtained from offlaoded tracks (DSP) // Used in main thread and offload callback thread, protected by Mutex diff --git a/dom/media/omx/MediaCodecReader.h b/dom/media/omx/MediaCodecReader.h index 3f5b5e1decd9..ae4715825caa 100644 --- a/dom/media/omx/MediaCodecReader.h +++ b/dom/media/omx/MediaCodecReader.h @@ -178,10 +178,10 @@ protected: android::sp mExtractor; - MediaPromiseHolder mMetadataPromise; + MozPromiseHolder mMetadataPromise; // XXX Remove after bug 1168008 land. - MediaPromiseRequestHolder mMediaResourceRequest; - MediaPromiseHolder mMediaResourcePromise; + MozPromiseRequestHolder mMediaResourceRequest; + MozPromiseHolder mMediaResourcePromise; private: @@ -216,7 +216,7 @@ private: { AudioTrack(); // Protected by mTrackMonitor. - MediaPromiseHolder mAudioPromise; + MozPromiseHolder mAudioPromise; private: // Forbidden @@ -238,7 +238,7 @@ private: nsIntRect mPictureRect; gfx::IntRect mRelativePictureRect; // Protected by mTrackMonitor. - MediaPromiseHolder mVideoPromise; + MozPromiseHolder mVideoPromise; nsRefPtr mReleaseBufferTaskQueue; private: diff --git a/dom/media/omx/MediaOmxCommonReader.h b/dom/media/omx/MediaOmxCommonReader.h index 1ff1554b6cbd..b2b90182e83e 100644 --- a/dom/media/omx/MediaOmxCommonReader.h +++ b/dom/media/omx/MediaOmxCommonReader.h @@ -24,7 +24,7 @@ class AbstractMediaDecoder; class MediaOmxCommonReader : public MediaDecoderReader { public: - typedef MediaPromise MediaResourcePromise; + typedef MozPromise MediaResourcePromise; MediaOmxCommonReader(AbstractMediaDecoder* aDecoder); diff --git a/dom/media/omx/MediaOmxReader.h b/dom/media/omx/MediaOmxReader.h index e0134cdb67fe..0eac90b2f0ee 100644 --- a/dom/media/omx/MediaOmxReader.h +++ b/dom/media/omx/MediaOmxReader.h @@ -44,11 +44,11 @@ class MediaOmxReader : public MediaOmxCommonReader // If mIsShutdown is false, and mShutdownMutex is held, then // AbstractMediaDecoder::mDecoder will be non-null. bool mIsShutdown; - MediaPromiseHolder mMetadataPromise; - MediaPromiseRequestHolder mMediaResourceRequest; + MozPromiseHolder mMetadataPromise; + MozPromiseRequestHolder mMediaResourceRequest; - MediaPromiseHolder mSeekPromise; - MediaPromiseRequestHolder mSeekRequest; + MozPromiseHolder mSeekPromise; + MozPromiseRequestHolder mSeekRequest; protected: android::sp mOmxDecoder; android::sp mExtractor; @@ -113,7 +113,7 @@ public: android::sp GetAudioOffloadTrack(); // This method is intended only for private use but public only for - // MediaPromise::InvokeCallbackMethod(). + // MozPromise::InvokeCallbackMethod(). void ReleaseDecoder(); private: diff --git a/dom/media/omx/OmxDecoder.h b/dom/media/omx/OmxDecoder.h index edf570b853f1..bcbae2476b7c 100644 --- a/dom/media/omx/OmxDecoder.h +++ b/dom/media/omx/OmxDecoder.h @@ -121,7 +121,7 @@ class OmxDecoder : public OMXCodecProxy::CodecResourceListener { // 'true' if a read from the audio stream was done while reading the metadata bool mAudioMetadataRead; - mozilla::MediaPromiseHolder mMediaResourcePromise; + mozilla::MozPromiseHolder mMediaResourcePromise; void ReleaseVideoBuffer(); void ReleaseAudioBuffer(); diff --git a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp index f20e6bd04372..a1ea1edec172 100644 --- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp +++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp @@ -17,7 +17,7 @@ namespace mozilla { -typedef MediaPromiseRequestHolder DecryptPromiseRequestHolder; +typedef MozPromiseRequestHolder DecryptPromiseRequestHolder; static PLDHashOperator DropDecryptPromises(MediaRawData* aKey,