зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1731803 - Change QM_TO_RESULT to use generic ToResult function; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D126271
This commit is contained in:
Родитель
7243be3f7a
Коммит
c48363726e
|
@ -72,6 +72,6 @@ inline OkOrErr ToResult(QMResult&& aValue);
|
|||
// TODO: Maybe move this to mfbt/ResultExtensions.h
|
||||
#define MOZ_TO_RESULT(expr) ToResult(expr)
|
||||
|
||||
#define QM_TO_RESULT(expr) ToResult(ToQMResult(expr))
|
||||
#define QM_TO_RESULT(expr) ToResult<QMResult>(expr)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#endif
|
||||
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
|
||||
#ifdef QM_ERROR_STACKS_ENABLED
|
||||
# include "mozilla/ResultVariant.h"
|
||||
# include "nsError.h"
|
||||
#else
|
||||
# include "mozilla/ResultExtensions.h"
|
||||
# include "mozilla/ResultVariant.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -55,6 +55,11 @@ class [[nodiscard]] GenericErrorResult<QMResult> {
|
|||
operator nsresult() const { return mErrorValue.NSResult(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ResultTypeTraits<QMResult> {
|
||||
static QMResult From(nsresult aValue) { return ToQMResult(aValue); }
|
||||
};
|
||||
|
||||
inline OkOrErr ToResult(const QMResult& aValue) {
|
||||
if (NS_FAILED(aValue.NSResult())) {
|
||||
return Err(aValue);
|
||||
|
|
Загрузка…
Ссылка в новой задаче