Add gl::ErrorSet and angle::Result.

gl::ErrorSet can handle errors and is accessible from ContextImpl.
It allows the implementation to mutate the error set without using
the gl::Context directly.

angle::Result is the faster POD return value class. It should generate
optimal code. It can also be used seamlessly with the ANGLE_TRY macro.

Also introduces an internal enum as a workaround for generating and
consuming errors in the back-end. When the internal enum is used as
an error return value the error is not consumed in the front-end. This
is a temporary workaround only.

Bug: angleproject:2491
Bug: angleproject:2713
Change-Id: I6cbdaadd075ccbdf241844cbcbc4ed5c3be40a8b
Reviewed-on: https://chromium-review.googlesource.com/1133200
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 60494c0..fe12e2e 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -1024,7 +1024,8 @@
             Error err = syncState(context);
             if (err.isError())
             {
-                context->handleError(err);
+                // TODO(jmadill): Remove when refactor complete. http://anglebug.com/2491
+                const_cast<Context *>(context)->handleError(err);
                 return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatus, GLenum>();
             }
             if (!mImpl->checkStatus(context))