Bug 1361942 - Store ActualArgTypes instead of ArgTypes for we are sending data of ActualArgTypes types to another thread. r=gerald

This allows more use of the implicit version of InvokeAsync() without specifying the storage types explicitly.

MozReview-Commit-ID: 40WisaVX8Jy

--HG--
extra : rebase_source : ba34515788f0bc8264fac9a6897e234966d8b762
extra : source : b651963fe562755c0b2998ae6a95ffad400060ad
This commit is contained in:
JW Wang 2017-05-03 12:34:50 +08:00
Родитель 1442e63ce9
Коммит 316a8afe47
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -725,7 +725,7 @@ GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
} }
// DOM JSON parsing needs to run on the main thread. // DOM JSON parsing needs to run on the main thread.
return InvokeAsync<nsString&&>( return InvokeAsync(
mMainThread, this, __func__, mMainThread, this, __func__,
&GMPParent::ParseChromiumManifest, NS_ConvertUTF8toUTF16(json)); &GMPParent::ParseChromiumManifest, NS_ConvertUTF8toUTF16(json));
} }

Просмотреть файл

@ -642,7 +642,7 @@ GeckoMediaPluginServiceParent::AsyncAddPluginDirectory(const nsAString& aDirecto
nsString dir(aDirectory); nsString dir(aDirectory);
RefPtr<GeckoMediaPluginServiceParent> self = this; RefPtr<GeckoMediaPluginServiceParent> self = this;
return InvokeAsync<nsString&&>( return InvokeAsync(
thread, this, __func__, thread, this, __func__,
&GeckoMediaPluginServiceParent::AddOnGMPThread, dir) &GeckoMediaPluginServiceParent::AddOnGMPThread, dir)
->Then( ->Then(

Просмотреть файл

@ -1328,11 +1328,11 @@ InvokeAsync(AbstractThread* aTarget, ThisType* aThisVal, const char* aCallerName
RefPtr<PromiseType>(ThisType::*aMethod)(ArgTypes...), RefPtr<PromiseType>(ThisType::*aMethod)(ArgTypes...),
ActualArgTypes&&... aArgs) ActualArgTypes&&... aArgs)
{ {
static_assert(!detail::Any(IsPointer<ArgTypes>::value...), static_assert(!detail::Any(IsPointer<typename RemoveReference<ActualArgTypes>::Type>::value...),
"Cannot pass pointer types through InvokeAsync, Storages must be provided"); "Cannot pass pointer types through InvokeAsync, Storages must be provided");
static_assert(sizeof...(ArgTypes) == sizeof...(ActualArgTypes), static_assert(sizeof...(ArgTypes) == sizeof...(ActualArgTypes),
"Method's ArgTypes and ActualArgTypes should have equal sizes"); "Method's ArgTypes and ActualArgTypes should have equal sizes");
return detail::InvokeAsyncImpl<StoreCopyPassByRRef<typename Decay<ArgTypes>::Type>...>( return detail::InvokeAsyncImpl<StoreCopyPassByRRef<typename Decay<ActualArgTypes>::Type>...>(
aTarget, aThisVal, aCallerName, aMethod, aTarget, aThisVal, aCallerName, aMethod,
Forward<ActualArgTypes>(aArgs)...); Forward<ActualArgTypes>(aArgs)...);
} }