Loading mfbt/ResultExtensions.h +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ template <typename R, typename RArgMapper, typename Func, typename... Args> Result<R, nsresult> ToResultInvokeInternal(const Func& aFunc, const RArgMapper& aRArgMapper, Args&&... aArgs) { // XXX Thereotically, if R is a pointer to a non-refcounted type, this might // be a non-owning pointer, but unless we find a case where this actually is // relevant, it's safe to forbid any raw pointer result. static_assert( !std::is_pointer_v<R>, "Raw pointer results are not supported, please specify a smart pointer " "result type explicitly, so that getter_AddRefs is used"); R res; nsresult rv = aFunc(std::forward<Args>(aArgs)..., aRArgMapper(res)); if (NS_FAILED(rv)) { Loading Loading
mfbt/ResultExtensions.h +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ template <typename R, typename RArgMapper, typename Func, typename... Args> Result<R, nsresult> ToResultInvokeInternal(const Func& aFunc, const RArgMapper& aRArgMapper, Args&&... aArgs) { // XXX Thereotically, if R is a pointer to a non-refcounted type, this might // be a non-owning pointer, but unless we find a case where this actually is // relevant, it's safe to forbid any raw pointer result. static_assert( !std::is_pointer_v<R>, "Raw pointer results are not supported, please specify a smart pointer " "result type explicitly, so that getter_AddRefs is used"); R res; nsresult rv = aFunc(std::forward<Args>(aArgs)..., aRArgMapper(res)); if (NS_FAILED(rv)) { Loading