Created
July 15, 2016 14:21
-
-
Save wanderview/04b0515136bbca7f2b07ef15c7af2493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void | |
AssertAndSuppressCleanupFunc(ErrorResult* aRv) | |
{ | |
aRv->AssertReportedOrSuppressed(); | |
aRv->SuppressException(); | |
} | |
template <typename CleanupFunc = AssertAndSuppressCleanupFunc> | |
class ErrorResult | |
{ | |
~ErrorResult() | |
{ | |
CleanupFunc(this); | |
} | |
ErrorResult<AssertAndSuppressCleanupFunc>& operator() | |
{ | |
return *reinterpret_cast<ErrorResult<AssertAndSuppressCleanupFunc>*>(this); | |
} | |
}; | |
function SuppressCleanupFunc(ErrorResult* aRv) | |
{ | |
aRv->SuppressException(); | |
} | |
typedef ErrorResult<SuppressCleanupFunc> IgnoredErrorResult; | |
function EmptyCleanupFunc(ErrorResult* aRv) | |
{ | |
} | |
typedef ErrorResult<EmptyCleanupFunc> FastErrorResult; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment