mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-04 23:40:20 +00:00
Bug 1361263 - allow InvokeAsync() to accept a member function which is pass-by-reference. r=gerald
StoreCopyPassByRRef<> ensures a copy is stored in the runnable. We don't have to worry about the concern of bug 1300476. MozReview-Commit-ID: DHqlzlVLBFV --HG-- extra : rebase_source : 77f2175611aa6fad88207a771de75fd28fd46f21 extra : source : 429c62928fd43185da45c905a150cfbe84cb3cf7
This commit is contained in:
parent
480b73c38c
commit
47f3443d87
@ -70,7 +70,7 @@ MediaDecoderReaderWrapper::RequestVideoData(bool aSkipToNextKeyframe,
|
||||
}
|
||||
|
||||
int64_t startTime = StartTime().ToMicroseconds();
|
||||
return InvokeAsync<bool, media::TimeUnit&&>(
|
||||
return InvokeAsync(
|
||||
mReader->OwnerThread(), mReader.get(), __func__,
|
||||
&MediaDecoderReader::RequestVideoData,
|
||||
aSkipToNextKeyframe, aTimeThreshold)
|
||||
@ -87,7 +87,7 @@ MediaDecoderReaderWrapper::Seek(const SeekTarget& aTarget)
|
||||
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
||||
SeekTarget adjustedTarget = aTarget;
|
||||
adjustedTarget.SetTime(adjustedTarget.GetTime() + StartTime());
|
||||
return InvokeAsync<SeekTarget&&>(
|
||||
return InvokeAsync(
|
||||
mReader->OwnerThread(), mReader.get(), __func__,
|
||||
&MediaDecoderReader::Seek,
|
||||
Move(adjustedTarget));
|
||||
|
@ -3141,7 +3141,7 @@ MediaDecoderStateMachine::Seek(const SeekTarget& aTarget)
|
||||
RefPtr<MediaDecoder::SeekPromise>
|
||||
MediaDecoderStateMachine::InvokeSeek(const SeekTarget& aTarget)
|
||||
{
|
||||
return InvokeAsync<SeekTarget&&>(
|
||||
return InvokeAsync(
|
||||
OwnerThread(), this, __func__,
|
||||
&MediaDecoderStateMachine::Seek, aTarget);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ RefPtr<MediaSourceTrackDemuxer::SeekPromise>
|
||||
MediaSourceTrackDemuxer::Seek(const TimeUnit& aTime)
|
||||
{
|
||||
MOZ_ASSERT(mParent, "Called after BreackCycle()");
|
||||
return InvokeAsync<TimeUnit&&>(
|
||||
return InvokeAsync(
|
||||
mParent->GetTaskQueue(), this, __func__,
|
||||
&MediaSourceTrackDemuxer::DoSeek, aTime);
|
||||
}
|
||||
@ -365,7 +365,7 @@ RefPtr<MediaSourceTrackDemuxer::SkipAccessPointPromise>
|
||||
MediaSourceTrackDemuxer::SkipToNextRandomAccessPoint(
|
||||
const TimeUnit& aTimeThreshold)
|
||||
{
|
||||
return InvokeAsync<TimeUnit&&>(
|
||||
return InvokeAsync(
|
||||
mParent->GetTaskQueue(), this, __func__,
|
||||
&MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint,
|
||||
aTimeThreshold);
|
||||
|
@ -1328,12 +1328,11 @@ InvokeAsync(AbstractThread* aTarget, ThisType* aThisVal, const char* aCallerName
|
||||
RefPtr<PromiseType>(ThisType::*aMethod)(ArgTypes...),
|
||||
ActualArgTypes&&... aArgs)
|
||||
{
|
||||
static_assert((!detail::Any(IsReference<ArgTypes>::value...)) &&
|
||||
(!detail::Any(IsPointer<ArgTypes>::value...)),
|
||||
"Cannot pass reference/pointer types through InvokeAsync, Storages must be provided");
|
||||
static_assert(!detail::Any(IsPointer<ArgTypes>::value...),
|
||||
"Cannot pass pointer types through InvokeAsync, Storages must be provided");
|
||||
static_assert(sizeof...(ArgTypes) == sizeof...(ActualArgTypes),
|
||||
"Method's ArgTypes and ActualArgTypes should have equal sizes");
|
||||
return detail::InvokeAsyncImpl<StoreCopyPassByRRef<ArgTypes>...>(
|
||||
return detail::InvokeAsyncImpl<StoreCopyPassByRRef<typename Decay<ArgTypes>::Type>...>(
|
||||
aTarget, aThisVal, aCallerName, aMethod,
|
||||
Forward<ActualArgTypes>(aArgs)...);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user