mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1753919 - Allow non-copy C++ object for GeckoResult paramenter. r=geckoview-reviewers,bholley,agi
Actually, we require that the parameter of promise by `GeckoResult` has copy constructor. We should allow non-copy C++ class for this parameter. Differential Revision: https://phabricator.services.mozilla.com/D137974
This commit is contained in:
parent
926307a1d7
commit
b2edc6930a
@ -34,7 +34,7 @@ class GeckoResultCallback final
|
||||
OuterCallback outerCallback =
|
||||
[inner{std::move(aInnerCallback)}](mozilla::jni::Object::Param aParam) {
|
||||
ArgType converted = Java2Native<ArgType>(aParam);
|
||||
inner(converted);
|
||||
inner(std::move(converted));
|
||||
};
|
||||
auto native = MakeUnique<GeckoResultCallback>(std::move(outerCallback));
|
||||
Base::AttachNative(java, std::move(native));
|
||||
|
@ -1087,9 +1087,11 @@ class MozPromise : public MozPromiseBase {
|
||||
using jni::GeckoResultCallback;
|
||||
RefPtr<Private> p = new Private("GeckoResult Glue", false);
|
||||
auto resolve = GeckoResultCallback::CreateAndAttach<ResolveValueType>(
|
||||
[p](ResolveValueType aArg) { p->Resolve(aArg, __func__); });
|
||||
[p](ResolveValueType&& aArg) {
|
||||
p->Resolve(MaybeMove(aArg), __func__);
|
||||
});
|
||||
auto reject = GeckoResultCallback::CreateAndAttach<RejectValueType>(
|
||||
[p](RejectValueType aArg) { p->Reject(aArg, __func__); });
|
||||
[p](RejectValueType&& aArg) { p->Reject(MaybeMove(aArg), __func__); });
|
||||
aGeckoResult->NativeThen(resolve, reject);
|
||||
return p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user