Commit 2343836c by Jamie Madill Committed by Commit Bot

Remove gl::ErrorOrResult.

Bug: angleproject:2491 Change-Id: Ief728b9c50ee2e1925a9b286c52c8ccda6b14fd2 Reviewed-on: https://chromium-review.googlesource.com/c/1255646 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@google.com> Reviewed-by: 's avatarFrank Henigman <fjhenigman@chromium.org>
parent 785e8a0b
...@@ -21,28 +21,6 @@ ...@@ -21,28 +21,6 @@
namespace angle namespace angle
{ {
template <typename ErrorT, typename ResultT, typename ErrorBaseT, ErrorBaseT NoErrorVal>
class ANGLE_NO_DISCARD ErrorOrResultBase
{
public:
ErrorOrResultBase(const ErrorT &error) : mError(error) {}
ErrorOrResultBase(ErrorT &&error) : mError(std::move(error)) {}
ErrorOrResultBase(ResultT &&result) : mError(NoErrorVal), mResult(std::forward<ResultT>(result))
{
}
ErrorOrResultBase(const ResultT &result) : mError(NoErrorVal), mResult(result) {}
bool isError() const { return mError.isError(); }
const ErrorT &getError() const { return mError; }
ResultT &&getResult() { return std::move(mResult); }
private:
ErrorT mError;
ResultT mResult;
};
template <typename ErrorT, typename ErrorBaseT, ErrorBaseT NoErrorVal, typename CodeT, CodeT EnumT> template <typename ErrorT, typename ErrorBaseT, ErrorBaseT NoErrorVal, typename CodeT, CodeT EnumT>
class ErrorStreamBase : angle::NonCopyable class ErrorStreamBase : angle::NonCopyable
{ {
...@@ -59,12 +37,6 @@ class ErrorStreamBase : angle::NonCopyable ...@@ -59,12 +37,6 @@ class ErrorStreamBase : angle::NonCopyable
operator ErrorT() { return ErrorT(EnumT, mID, mErrorStream.str()); } operator ErrorT() { return ErrorT(EnumT, mID, mErrorStream.str()); }
template <typename ResultT>
operator ErrorOrResultBase<ErrorT, ResultT, ErrorBaseT, NoErrorVal>()
{
return static_cast<ErrorT>(*this);
}
private: private:
GLuint mID; GLuint mID;
std::ostringstream mErrorStream; std::ostringstream mErrorStream;
...@@ -119,9 +91,6 @@ class ANGLE_NO_DISCARD Error final ...@@ -119,9 +91,6 @@ class ANGLE_NO_DISCARD Error final
mutable std::unique_ptr<std::string> mMessage; mutable std::unique_ptr<std::string> mMessage;
}; };
template <typename ResultT>
using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, GLenum, GL_NO_ERROR>;
namespace priv namespace priv
{ {
...@@ -185,9 +154,6 @@ class ANGLE_NO_DISCARD Error final ...@@ -185,9 +154,6 @@ class ANGLE_NO_DISCARD Error final
mutable std::unique_ptr<std::string> mMessage; mutable std::unique_ptr<std::string> mMessage;
}; };
template <typename ResultT>
using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, EGLint, EGL_SUCCESS>;
namespace priv namespace priv
{ {
...@@ -294,13 +260,6 @@ class ANGLE_NO_DISCARD Result ...@@ -294,13 +260,6 @@ class ANGLE_NO_DISCARD Result
// TODO(jmadill): Remove when refactor is complete. http://anglebug.com/2491 // TODO(jmadill): Remove when refactor is complete. http://anglebug.com/2491
operator gl::Error() const; operator gl::Error() const;
// TODO(jmadill): Remove when refactor is complete. http://anglebug.com/2491
template <typename T>
operator gl::ErrorOrResult<T>() const
{
return operator gl::Error();
}
bool operator==(Result other) const { return mValue == other.mValue; } bool operator==(Result other) const { return mValue == other.mValue; }
bool operator!=(Result other) const { return mValue != other.mValue; } bool operator!=(Result other) const { return mValue != other.mValue; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment