Bug 1184634 - Rename MediaPromise to MozPromise. r=gerald

This commit is contained in:
Bobby Holley 2015-07-16 11:06:49 -07:00
parent 343f18704f
commit 3a79ae9cf8
29 changed files with 184 additions and 184 deletions

View File

@ -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<nsresult, DemuxerFailureReason, /* IsExclusive = */ true> InitPromise;
typedef MozPromise<nsresult, DemuxerFailureReason, /* IsExclusive = */ true> 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<media::TimeUnit, DemuxerFailureReason, /* IsExclusive = */ true> SeekPromise;
typedef MediaPromise<nsRefPtr<SamplesHolder>, DemuxerFailureReason, /* IsExclusive = */ true> SamplesPromise;
typedef MediaPromise<uint32_t, SkipFailureHolder, /* IsExclusive = */ true> SkipAccessPointPromise;
typedef MozPromise<media::TimeUnit, DemuxerFailureReason, /* IsExclusive = */ true> SeekPromise;
typedef MozPromise<nsRefPtr<SamplesHolder>, DemuxerFailureReason, /* IsExclusive = */ true> SamplesPromise;
typedef MozPromise<uint32_t, SkipFailureHolder, /* IsExclusive = */ true> SkipAccessPointPromise;
// Returns the TrackInfo (a.k.a Track Description) for this track.
// The TrackInfo returned will be:

View File

@ -121,7 +121,7 @@ public:
StaticRefPtr<MediaMemoryTracker> 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");

View File

@ -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<SeekResolveValue, bool /* aIgnored */, /* IsExclusive = */ true> SeekPromise;
typedef MozPromise<SeekResolveValue, bool /* aIgnored */, /* IsExclusive = */ true> SeekPromise;
NS_DECL_THREADSAFE_ISUPPORTS
@ -986,7 +986,7 @@ protected:
// Returns true if heuristic dormant is supported.
bool IsHeuristicDormantSupported() const;
MediaPromiseRequestHolder<SeekPromise> mSeekRequest;
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

View File

@ -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<nsRefPtr<MetadataHolder>, ReadMetadataFailureReason, /* IsExclusive = */ true> MetadataPromise;
typedef MediaPromise<nsRefPtr<AudioData>, NotDecodedReason, /* IsExclusive = */ true> AudioDataPromise;
typedef MediaPromise<nsRefPtr<VideoData>, NotDecodedReason, /* IsExclusive = */ true> VideoDataPromise;
typedef MediaPromise<int64_t, nsresult, /* IsExclusive = */ true> SeekPromise;
typedef MozPromise<nsRefPtr<MetadataHolder>, ReadMetadataFailureReason, /* IsExclusive = */ true> MetadataPromise;
typedef MozPromise<nsRefPtr<AudioData>, NotDecodedReason, /* IsExclusive = */ true> AudioDataPromise;
typedef MozPromise<nsRefPtr<VideoData>, NotDecodedReason, /* IsExclusive = */ true> VideoDataPromise;
typedef MozPromise<int64_t, nsresult, /* IsExclusive = */ true> 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<MediaData::Type, WaitForDataRejectValue, /* IsExclusive = */ true> WaitForDataPromise;
typedef MozPromise<MediaData::Type, WaitForDataRejectValue, /* IsExclusive = */ true> WaitForDataPromise;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
@ -386,7 +386,7 @@ protected:
Mirror<media::NullableTimeUnit> mDuration;
// State for ThrottledNotifyDataArrived.
MediaPromiseRequestHolder<MediaTimerPromise> mThrottledNotify;
MozPromiseRequestHolder<MediaTimerPromise> mThrottledNotify;
const TimeDuration mThrottleDuration;
TimeStamp mLastThrottledNotify;
Maybe<media::Interval<int64_t>> mThrottledInterval;
@ -420,8 +420,8 @@ protected:
private:
// Promises used only for the base-class (sync->async adapter) implementation
// of Request{Audio,Video}Data.
MediaPromiseHolder<AudioDataPromise> mBaseAudioPromise;
MediaPromiseHolder<VideoDataPromise> mBaseVideoPromise;
MozPromiseHolder<AudioDataPromise> mBaseAudioPromise;
MozPromiseHolder<VideoDataPromise> mBaseVideoPromise;
bool mTaskQueueIsBorrowed;

View File

@ -766,7 +766,7 @@ private:
private:
MediaDecoderStateMachine* mSelf;
nsRefPtr<MediaTimer> mMediaTimer;
MediaPromiseRequestHolder<mozilla::MediaTimerPromise> mRequest;
MozPromiseRequestHolder<mozilla::MediaTimerPromise> mRequest;
TimeStamp mTarget;
} mDelayedScheduler;
@ -778,7 +778,7 @@ private:
public:
typedef MediaDecoderReader::AudioDataPromise AudioDataPromise;
typedef MediaDecoderReader::VideoDataPromise VideoDataPromise;
typedef MediaPromise<bool, bool, /* isExclusive = */ false> HaveStartTimePromise;
typedef MozPromise<bool, bool, /* isExclusive = */ false> 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<HaveStartTimePromise> mHaveStartTimePromise;
MozPromiseHolder<HaveStartTimePromise> mHaveStartTimePromise;
nsRefPtr<AbstractThread> mOwnerThread;
Maybe<int64_t> mAudioStartTime;
Maybe<int64_t> mVideoStartTime;
@ -999,7 +999,7 @@ private:
}
SeekTarget mTarget;
MediaPromiseHolder<MediaDecoder::SeekPromise> mPromise;
MozPromiseHolder<MediaDecoder::SeekPromise> 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<MediaDecoderReader::AudioDataPromise> mAudioDataRequest;
MediaPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise> mAudioWaitRequest;
MozPromiseRequestHolder<MediaDecoderReader::AudioDataPromise> mAudioDataRequest;
MozPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise> mAudioWaitRequest;
const char* AudioRequestStatus()
{
MOZ_ASSERT(OnTaskQueue());
@ -1171,8 +1171,8 @@ private:
return "idle";
}
MediaPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise> mVideoWaitRequest;
MediaPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mVideoDataRequest;
MozPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise> mVideoWaitRequest;
MozPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mVideoDataRequest;
const char* VideoRequestStatus()
{
MOZ_ASSERT(OnTaskQueue());
@ -1185,7 +1185,7 @@ private:
return "idle";
}
MediaPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise>& WaitRequestRef(MediaData::Type aType)
MozPromiseRequestHolder<MediaDecoderReader::WaitForDataPromise>& 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<MediaDecoderReader::SeekPromise> mSeekRequest;
MozPromiseRequestHolder<MediaDecoderReader::SeekPromise> 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<MediaDecoderReader::MetadataPromise> mMetadataRequest;
MozPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
// Stores presentation info required for playback. The decoder monitor
// must be held when accessing this.

View File

@ -227,12 +227,12 @@ private:
bool mDiscontinuity;
// Pending seek.
MediaPromiseRequestHolder<MediaTrackDemuxer::SeekPromise> mSeekRequest;
MozPromiseRequestHolder<MediaTrackDemuxer::SeekPromise> mSeekRequest;
// Queued demux samples waiting to be decoded.
nsTArray<nsRefPtr<MediaRawData>> mQueuedSamples;
MediaPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> mDemuxRequest;
MediaPromiseHolder<WaitForDataPromise> mWaitingPromise;
MozPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> mDemuxRequest;
MozPromiseHolder<WaitForDataPromise> mWaitingPromise;
bool HasWaitingPromise()
{
MOZ_ASSERT(mOwner->OnTaskQueue());
@ -308,7 +308,7 @@ private:
DecoderData(aOwner, aType, aDecodeAhead)
{}
MediaPromiseHolder<PromiseType> mPromise;
MozPromiseHolder<PromiseType> mPromise;
bool HasPromise() override
{
@ -335,7 +335,7 @@ private:
// Demuxer objects.
void OnDemuxerInitDone(nsresult);
void OnDemuxerInitFailed(DemuxerFailureReason aFailure);
MediaPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
MozPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
void OnDemuxFailed(TrackType aTrack, DemuxerFailureReason aFailure);
void DoDemuxVideo();
@ -353,7 +353,7 @@ private:
}
void SkipVideoDemuxToNextKeyFrame(media::TimeUnit aTimeThreshold);
MediaPromiseRequestHolder<MediaTrackDemuxer::SkipAccessPointPromise> mSkipRequest;
MozPromiseRequestHolder<MediaTrackDemuxer::SkipAccessPointPromise> 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<MetadataPromise> mMetadataPromise;
MozPromiseHolder<MetadataPromise> 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<media::TimeUnit> mPendingSeekTime;
MediaPromiseHolder<SeekPromise> mSeekPromise;
MozPromiseHolder<SeekPromise> mSeekPromise;
#ifdef MOZ_EME
nsRefPtr<CDMProxy> mCDMProxy;

View File

@ -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<bool, bool, false> ShutdownPromise;
typedef MozPromise<bool, bool, false> 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<ShutdownPromise> mShutdownPromise;
MozPromiseHolder<ShutdownPromise> mShutdownPromise;
// True if we're flushing; we reject new tasks if we're flushing.
bool mIsFlushing;

View File

@ -7,7 +7,7 @@
#if !defined(MediaTimer_h_)
#define MediaTimer_h_
#include "MediaPromise.h"
#include "MozPromise.h"
#include <queue>
@ -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<bool, bool, /* IsExclusive = */ true> MediaTimerPromise;
typedef MozPromise<bool, bool, /* IsExclusive = */ true> 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
{

View File

@ -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<typename ThisType, typename Ret, typename ArgType>
@ -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<typename T> class MediaPromiseHolder;
template<typename T> class MozPromiseHolder;
template<typename ResolveValueT, typename RejectValueT, bool IsExclusive>
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<typename ResolveValueType_>
static nsRefPtr<MediaPromise>
static nsRefPtr<MozPromise>
CreateAndResolve(ResolveValueType_&& aResolveValue, const char* aResolveSite)
{
nsRefPtr<typename MediaPromise::Private> p = new MediaPromise::Private(aResolveSite);
nsRefPtr<typename MozPromise::Private> p = new MozPromise::Private(aResolveSite);
p->Resolve(Forward<ResolveValueType_>(aResolveValue), aResolveSite);
return p.forget();
}
template<typename RejectValueType_>
static nsRefPtr<MediaPromise>
static nsRefPtr<MozPromise>
CreateAndReject(RejectValueType_&& aRejectValue, const char* aRejectSite)
{
nsRefPtr<typename MediaPromise::Private> p = new MediaPromise::Private(aRejectSite);
nsRefPtr<typename MozPromise::Private> p = new MozPromise::Private(aRejectSite);
p->Reject(Forward<RejectValueType_>(aRejectValue), aRejectSite);
return p.forget();
}
typedef MediaPromise<nsTArray<ResolveValueType>, RejectValueType, IsExclusive> AllPromiseType;
typedef MozPromise<nsTArray<ResolveValueType>, 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<AllPromiseType> All(AbstractThread* aProcessingThread, nsTArray<nsRefPtr<MediaPromise>>& aPromises)
static nsRefPtr<AllPromiseType> All(AbstractThread* aProcessingThread, nsTArray<nsRefPtr<MozPromise>>& aPromises)
{
nsRefPtr<AllPromiseHolder> 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<ThenValueBase> mThenValue;
nsRefPtr<MediaPromise> mPromise;
nsRefPtr<MozPromise> 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("<completion promise>");
mCompletionPromise = new MozPromise::Private("<completion promise>");
}
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<MediaPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) = 0;
virtual already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) = 0;
void DoResolveOrReject(const ResolveOrRejectValue& aValue)
{
@ -382,16 +382,16 @@ protected:
}
// Invoke the resolve or reject method.
nsRefPtr<MediaPromise> p = DoResolveOrRejectInternal(aValue);
nsRefPtr<MozPromise> 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<MediaPromise::Private> completionPromise =
dont_AddRef(static_cast<MediaPromise::Private*>(mCompletionPromise.forget().take()));
// MozPromise::Private. See the declaration below.
nsRefPtr<MozPromise::Private> completionPromise =
dont_AddRef(static_cast<MozPromise::Private*>(mCompletionPromise.forget().take()));
if (completionPromise) {
if (p) {
p->ChainTo(completionPromise.forget(), "<chained completion promise>");
@ -403,11 +403,11 @@ protected:
nsRefPtr<AbstractThread> mResponseTarget; // May be released on any thread.
// Declaring nsRefPtr<MediaPromise::Private> 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<MozPromise::Private> 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<MediaPromise> mCompletionPromise;
nsRefPtr<MozPromise> mCompletionPromise;
const char* mCallSite;
};
@ -418,9 +418,9 @@ protected:
*/
template<typename ThisType, typename MethodType, typename ValueType>
static typename EnableIf<ReturnTypeIs<MethodType, nsRefPtr<MediaPromise>>::value &&
static typename EnableIf<ReturnTypeIs<MethodType, nsRefPtr<MozPromise>>::value &&
TakesArgument<MethodType>::value,
already_AddRefed<MediaPromise>>::Type
already_AddRefed<MozPromise>>::Type
InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue)
{
return ((*aThisVal).*aMethod)(Forward<ValueType>(aValue)).forget();
@ -429,7 +429,7 @@ protected:
template<typename ThisType, typename MethodType, typename ValueType>
static typename EnableIf<ReturnTypeIs<MethodType, void>::value &&
TakesArgument<MethodType>::value,
already_AddRefed<MediaPromise>>::Type
already_AddRefed<MozPromise>>::Type
InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue)
{
((*aThisVal).*aMethod)(Forward<ValueType>(aValue));
@ -437,9 +437,9 @@ protected:
}
template<typename ThisType, typename MethodType, typename ValueType>
static typename EnableIf<ReturnTypeIs<MethodType, nsRefPtr<MediaPromise>>::value &&
static typename EnableIf<ReturnTypeIs<MethodType, nsRefPtr<MozPromise>>::value &&
!TakesArgument<MethodType>::value,
already_AddRefed<MediaPromise>>::Type
already_AddRefed<MozPromise>>::Type
InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue)
{
return ((*aThisVal).*aMethod)().forget();
@ -448,7 +448,7 @@ protected:
template<typename ThisType, typename MethodType, typename ValueType>
static typename EnableIf<ReturnTypeIs<MethodType, void>::value &&
!TakesArgument<MethodType>::value,
already_AddRefed<MediaPromise>>::Type
already_AddRefed<MozPromise>>::Type
InvokeCallbackMethod(ThisType* aThisVal, MethodType aMethod, ValueType&& aValue)
{
((*aThisVal).*aMethod)();
@ -478,9 +478,9 @@ protected:
}
protected:
virtual already_AddRefed<MediaPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
virtual already_AddRefed<MozPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
{
nsRefPtr<MediaPromise> completion;
nsRefPtr<MozPromise> completion;
if (aValue.IsResolve()) {
completion = InvokeCallbackMethod(mThisVal.get(), mResolveMethod, aValue.ResolveValue());
} else {
@ -530,14 +530,14 @@ protected:
}
protected:
virtual already_AddRefed<MediaPromise> DoResolveOrRejectInternal(const ResolveOrRejectValue& aValue) override
virtual already_AddRefed<MozPromise> 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<MediaPromise> completion;
nsRefPtr<MozPromise> 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<typename ResolveValueT, typename RejectValueT, bool IsExclusive>
class MediaPromise<ResolveValueT, RejectValueT, IsExclusive>::Private
: public MediaPromise<ResolveValueT, RejectValueT, IsExclusive>
class MozPromise<ResolveValueT, RejectValueT, IsExclusive>::Private
: public MozPromise<ResolveValueT, RejectValueT, IsExclusive>
{
public:
explicit Private(const char* aCreationSite) : MediaPromise(aCreationSite) {}
explicit Private(const char* aCreationSite) : MozPromise(aCreationSite) {}
template<typename ResolveValueT_>
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<ResolveValueT_>(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<RejectValueT_>(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<ResolveOrRejectValue_>(aValue);
DispatchAll();
}
};
// A generic promise type that does the trick for simple use cases.
typedef MediaPromise<bool, nsresult, /* IsExclusive = */ false> GenericPromise;
typedef MozPromise<bool, nsresult, /* IsExclusive = */ false> 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<typename PromiseType>
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<PromiseType> 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<typename PromiseType>
class MediaPromiseRequestHolder
class MozPromiseRequestHolder
{
public:
MediaPromiseRequestHolder() {}
~MediaPromiseRequestHolder() { MOZ_ASSERT(!mRequest); }
MozPromiseRequestHolder() {}
~MozPromiseRequestHolder() { MOZ_ASSERT(!mRequest); }
void Begin(typename PromiseType::Request* aRequest)
{

View File

@ -7,7 +7,7 @@
#if !defined(StateMirroring_h_)
#define StateMirroring_h_
#include "MediaPromise.h"
#include "MozPromise.h"
#include "StateWatching.h"
#include "TaskDispatcher.h"

View File

@ -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

View File

@ -36,8 +36,8 @@ class AndroidMediaReader : public MediaDecoderReader
int64_t mVideoSeekTimeUs;
int64_t mAudioSeekTimeUs;
nsRefPtr<VideoData> mLastVideoFrame;
MediaPromiseHolder<MediaDecoderReader::SeekPromise> mSeekPromise;
MediaPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mSeekRequest;
MozPromiseHolder<MediaDecoderReader::SeekPromise> mSeekPromise;
MozPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mSeekRequest;
public:
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
const nsACString& aContentType);

View File

@ -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<DecryptResult, DecryptResult, /* IsExclusive = */ true> DecryptPromise;
typedef MozPromise<DecryptResult, DecryptResult, /* IsExclusive = */ true> DecryptPromise;
// Main thread only.
CDMProxy(dom::MediaKeys* aKeys, const nsAString& aKeySystem);
@ -259,7 +259,7 @@ private:
nsRefPtr<MediaRawData> mSample;
private:
~DecryptJob() {}
MediaPromiseHolder<DecryptPromise> mPromise;
MozPromiseHolder<DecryptPromise> mPromise;
};
// GMP thread only.
void gmp_Decrypt(nsRefPtr<DecryptJob> aJob);

View File

@ -224,7 +224,7 @@ private:
mPromise.SetMonitor(&mMonitor);
}
MediaPromiseHolder<PromiseType> mPromise;
MozPromiseHolder<PromiseType> mPromise;
bool HasPromise() override { return !mPromise.IsEmpty(); }
void RejectPromise(MediaDecoderReader::NotDecodedReason aReason,

View File

@ -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<int, double, false> TestPromise;
typedef MozPromise<int, double, false> 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<MediaTaskQueue> queue = atq.TaskQueue();
@ -99,7 +99,7 @@ TEST(MediaPromise, BasicResolve)
});
}
TEST(MediaPromise, BasicReject)
TEST(MozPromise, BasicReject)
{
AutoTaskQueue atq;
nsRefPtr<MediaTaskQueue> queue = atq.TaskQueue();
@ -110,7 +110,7 @@ TEST(MediaPromise, BasicReject)
});
}
TEST(MediaPromise, AsyncResolve)
TEST(MozPromise, AsyncResolve)
{
AutoTaskQueue atq;
nsRefPtr<MediaTaskQueue> 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<MediaTaskQueue> queue = atq.TaskQueue();
@ -195,7 +195,7 @@ TEST(MediaPromise, PromiseAllResolve)
});
}
TEST(MediaPromise, PromiseAllReject)
TEST(MozPromise, PromiseAllReject)
{
AutoTaskQueue atq;
nsRefPtr<MediaTaskQueue> queue = atq.TaskQueue();

View File

@ -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)

View File

@ -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<TrackBuffer> mAudioTrack;
nsRefPtr<TrackBuffer> mVideoTrack;
MediaPromiseRequestHolder<AudioDataPromise> mAudioRequest;
MediaPromiseRequestHolder<VideoDataPromise> mVideoRequest;
MozPromiseRequestHolder<AudioDataPromise> mAudioRequest;
MozPromiseRequestHolder<VideoDataPromise> mVideoRequest;
MediaPromiseHolder<AudioDataPromise> mAudioPromise;
MediaPromiseHolder<VideoDataPromise> mVideoPromise;
MozPromiseHolder<AudioDataPromise> mAudioPromise;
MozPromiseHolder<VideoDataPromise> mVideoPromise;
MediaPromiseHolder<WaitForDataPromise> mAudioWaitPromise;
MediaPromiseHolder<WaitForDataPromise> mVideoWaitPromise;
MediaPromiseHolder<WaitForDataPromise>& WaitPromise(MediaData::Type aType)
MozPromiseHolder<WaitForDataPromise> mAudioWaitPromise;
MozPromiseHolder<WaitForDataPromise> mVideoWaitPromise;
MozPromiseHolder<WaitForDataPromise>& WaitPromise(MediaData::Type aType)
{
return aType == MediaData::AUDIO_DATA ? mAudioWaitPromise : mVideoWaitPromise;
}
@ -257,9 +257,9 @@ private:
bool mForceVideoDecodeAhead;
MediaPromiseRequestHolder<SeekPromise> mAudioSeekRequest;
MediaPromiseRequestHolder<SeekPromise> mVideoSeekRequest;
MediaPromiseHolder<SeekPromise> mSeekPromise;
MozPromiseRequestHolder<SeekPromise> mAudioSeekRequest;
MozPromiseRequestHolder<SeekPromise> mVideoSeekRequest;
MozPromiseHolder<SeekPromise> 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<ShutdownPromise> mMediaSourceShutdownPromise;
MozPromiseHolder<ShutdownPromise> mMediaSourceShutdownPromise;
#ifdef MOZ_FMP4
nsRefPtr<SharedDecoderManager> mSharedDecoderManager;
#endif

View File

@ -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<SourceBufferContentManager::AppendPromise> mPendingAppend;
MozPromiseRequestHolder<SourceBufferContentManager::AppendPromise> mPendingAppend;
const nsCString mType;
};

View File

@ -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<bool, nsresult, /* IsExclusive = */ true> AppendPromise;
typedef MozPromise<bool, nsresult, /* IsExclusive = */ true> AppendPromise;
typedef AppendPromise RangeRemovalPromise;
static already_AddRefed<SourceBufferContentManager>

View File

@ -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__);
}

View File

@ -138,7 +138,7 @@ private:
// Queue on the parent's decoder task queue a call to NotifyDataRemoved.
void NotifyReaderDataRemoved(MediaDecoderReader* aReader);
typedef MediaPromise<bool, nsresult, /* IsExclusive = */ true> BufferedRangesUpdatedPromise;
typedef MozPromise<bool, nsresult, /* IsExclusive = */ true> BufferedRangesUpdatedPromise;
nsRefPtr<BufferedRangesUpdatedPromise> UpdateBufferedRanges(Interval<int64_t> aByteRange, bool aNotifyParent);
// Queue execution of InitializeDecoder on mTaskQueue.
@ -226,15 +226,15 @@ private:
MediaInfo mInfo;
void ContinueShutdown();
MediaPromiseHolder<ShutdownPromise> mShutdownPromise;
MozPromiseHolder<ShutdownPromise> mShutdownPromise;
bool mDecoderPerSegment;
bool mShutdown;
MediaPromiseHolder<AppendPromise> mInitializationPromise;
MozPromiseHolder<AppendPromise> mInitializationPromise;
// Track our request for metadata from the reader.
MediaPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
MozPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
MediaPromiseHolder<RangeRemovalPromise> mRangeRemovalPromise;
MozPromiseHolder<RangeRemovalPromise> mRangeRemovalPromise;
Interval<int64_t> mLastAppendRange;

View File

@ -34,7 +34,7 @@ using dom::SourceBufferAppendMode;
class TrackBuffersManager : public SourceBufferContentManager {
public:
typedef MediaPromise<bool, nsresult, /* IsExclusive = */ true> CodedFrameProcessingPromise;
typedef MozPromise<bool, nsresult, /* IsExclusive = */ true> CodedFrameProcessingPromise;
typedef TrackInfo::TrackType TrackType;
typedef MediaData::Type MediaType;
typedef nsTArray<nsRefPtr<MediaRawData>> TrackBuffer;
@ -166,7 +166,7 @@ private:
void OnDemuxerInitDone(nsresult);
void OnDemuxerInitFailed(DemuxerFailureReason aFailure);
MediaPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
MozPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
bool mEncrypted;
void OnDemuxFailed(TrackType aTrack, DemuxerFailureReason aFailure);
@ -221,7 +221,7 @@ private:
// buffer.
bool mNeedRandomAccessPoint;
nsRefPtr<MediaTrackDemuxer> mDemuxer;
MediaPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> mDemuxRequest;
MozPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> 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<CodedFrameProcessingPromise> mProcessingRequest;
MediaPromiseHolder<CodedFrameProcessingPromise> mProcessingPromise;
MozPromiseRequestHolder<CodedFrameProcessingPromise> mProcessingRequest;
MozPromiseHolder<CodedFrameProcessingPromise> mProcessingPromise;
MediaPromiseHolder<AppendPromise> mAppendPromise;
MozPromiseHolder<AppendPromise> 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.

View File

@ -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',

View File

@ -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<MediaDecoder::SeekPromise> mSeekPromise;
MozPromiseHolder<MediaDecoder::SeekPromise> mSeekPromise;
// Positions obtained from offlaoded tracks (DSP)
// Used in main thread and offload callback thread, protected by Mutex

View File

@ -178,10 +178,10 @@ protected:
android::sp<android::MediaExtractor> mExtractor;
MediaPromiseHolder<MediaDecoderReader::MetadataPromise> mMetadataPromise;
MozPromiseHolder<MediaDecoderReader::MetadataPromise> mMetadataPromise;
// XXX Remove after bug 1168008 land.
MediaPromiseRequestHolder<MediaResourcePromise> mMediaResourceRequest;
MediaPromiseHolder<MediaResourcePromise> mMediaResourcePromise;
MozPromiseRequestHolder<MediaResourcePromise> mMediaResourceRequest;
MozPromiseHolder<MediaResourcePromise> mMediaResourcePromise;
private:
@ -216,7 +216,7 @@ private:
{
AudioTrack();
// Protected by mTrackMonitor.
MediaPromiseHolder<AudioDataPromise> mAudioPromise;
MozPromiseHolder<AudioDataPromise> mAudioPromise;
private:
// Forbidden
@ -238,7 +238,7 @@ private:
nsIntRect mPictureRect;
gfx::IntRect mRelativePictureRect;
// Protected by mTrackMonitor.
MediaPromiseHolder<VideoDataPromise> mVideoPromise;
MozPromiseHolder<VideoDataPromise> mVideoPromise;
nsRefPtr<MediaTaskQueue> mReleaseBufferTaskQueue;
private:

View File

@ -24,7 +24,7 @@ class AbstractMediaDecoder;
class MediaOmxCommonReader : public MediaDecoderReader
{
public:
typedef MediaPromise<bool /* aIgnored */, bool /* aIgnored */, /* IsExclusive = */ true> MediaResourcePromise;
typedef MozPromise<bool /* aIgnored */, bool /* aIgnored */, /* IsExclusive = */ true> MediaResourcePromise;
MediaOmxCommonReader(AbstractMediaDecoder* aDecoder);

View File

@ -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<MediaDecoderReader::MetadataPromise> mMetadataPromise;
MediaPromiseRequestHolder<MediaResourcePromise> mMediaResourceRequest;
MozPromiseHolder<MediaDecoderReader::MetadataPromise> mMetadataPromise;
MozPromiseRequestHolder<MediaResourcePromise> mMediaResourceRequest;
MediaPromiseHolder<MediaDecoderReader::SeekPromise> mSeekPromise;
MediaPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mSeekRequest;
MozPromiseHolder<MediaDecoderReader::SeekPromise> mSeekPromise;
MozPromiseRequestHolder<MediaDecoderReader::VideoDataPromise> mSeekRequest;
protected:
android::sp<android::OmxDecoder> mOmxDecoder;
android::sp<android::MediaExtractor> mExtractor;
@ -113,7 +113,7 @@ public:
android::sp<android::MediaSource> GetAudioOffloadTrack();
// This method is intended only for private use but public only for
// MediaPromise::InvokeCallbackMethod().
// MozPromise::InvokeCallbackMethod().
void ReleaseDecoder();
private:

View File

@ -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<MediaResourcePromise> mMediaResourcePromise;
mozilla::MozPromiseHolder<MediaResourcePromise> mMediaResourcePromise;
void ReleaseVideoBuffer();
void ReleaseAudioBuffer();

View File

@ -17,7 +17,7 @@
namespace mozilla {
typedef MediaPromiseRequestHolder<CDMProxy::DecryptPromise> DecryptPromiseRequestHolder;
typedef MozPromiseRequestHolder<CDMProxy::DecryptPromise> DecryptPromiseRequestHolder;
static PLDHashOperator
DropDecryptPromises(MediaRawData* aKey,