Add a ContextImpl class.

This class can contain impl-specific functionality for a Context.
This will eventually replace the Renderer class, and we can then
start passing around a gl::Context instead of gl::ContextState.

In D3D11, the ContextImpl could hold a DeferredContext, which would
enable multi-thread rendering. In GL, we can implement non-virtual
(native) Contexts. In Vulkan it might store the logical device.

BUG=angleproject:1363

Change-Id: I39617e6d1a605d1a9574832e4d322400b09867ec
Reviewed-on: https://chromium-review.googlesource.com/340745
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 120cc73..454364c 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -65,13 +65,13 @@
 {
     if (!ValidTexture2DDestinationTarget(context, target))
     {
-        context->recordError(Error(GL_INVALID_ENUM));
+        context->handleError(Error(GL_INVALID_ENUM));
         return false;
     }
 
     if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
@@ -79,13 +79,13 @@
         std::numeric_limits<GLsizei>::max() - xoffset < width ||
         std::numeric_limits<GLsizei>::max() - yoffset < height)
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
     if (!isSubImage && !isCompressed && internalformat != format)
     {
-        context->recordError(Error(GL_INVALID_OPERATION));
+        context->handleError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
@@ -96,7 +96,7 @@
         if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
             static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
     }
@@ -104,27 +104,27 @@
     {
         if (!isSubImage && width != height)
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
 
         if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level) ||
             static_cast<GLuint>(height) > (caps.maxCubeMapTextureSize >> level))
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
     }
     else
     {
-        context->recordError(Error(GL_INVALID_ENUM));
+        context->handleError(Error(GL_INVALID_ENUM));
         return false;
     }
 
     gl::Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
     if (!texture)
     {
-        context->recordError(Error(GL_INVALID_OPERATION));
+        context->handleError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
@@ -134,7 +134,7 @@
         {
             if (gl::GetSizedInternalFormat(format, type) != texture->getInternalFormat(target, level))
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
         }
@@ -142,7 +142,7 @@
         if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
             static_cast<size_t>(yoffset + height) > texture->getHeight(target, level))
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
     }
@@ -150,7 +150,7 @@
     {
         if (texture->getImmutableFormat())
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
     }
@@ -158,7 +158,7 @@
     // Verify zero border
     if (border != 0)
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
@@ -172,47 +172,47 @@
           case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
             if (!context->getExtensions().textureCompressionDXT1)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
             if (!context->getExtensions().textureCompressionDXT1)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
             if (!context->getExtensions().textureCompressionDXT5)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_OES:
             if (!context->getExtensions().compressedETC1RGB8Texture)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
               if (!context->getExtensions().lossyETCDecode)
               {
-                  context->recordError(
+                  context->handleError(
                       Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported"));
                   return false;
               }
               break;
           default:
-              context->recordError(Error(
+              context->handleError(Error(
                   GL_INVALID_ENUM, "internalformat is not a supported compressed internal format"));
               return false;
         }
         if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
     }
@@ -232,7 +232,7 @@
           case GL_FLOAT:
             break;
           default:
-            context->recordError(Error(GL_INVALID_ENUM));
+              context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
 
@@ -251,7 +251,7 @@
               case GL_HALF_FLOAT_OES:
                 break;
               default:
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
             }
             break;
@@ -259,7 +259,7 @@
           case GL_RG:
               if (!context->getExtensions().textureRG)
               {
-                  context->recordError(Error(GL_INVALID_ENUM));
+                  context->handleError(Error(GL_INVALID_ENUM));
                   return false;
               }
               switch (type)
@@ -269,7 +269,7 @@
                 case GL_HALF_FLOAT_OES:
                   break;
                 default:
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                    context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -282,7 +282,7 @@
               case GL_HALF_FLOAT_OES:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -296,7 +296,7 @@
               case GL_HALF_FLOAT_OES:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -306,7 +306,7 @@
               case GL_UNSIGNED_BYTE:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -314,7 +314,7 @@
           case GL_SRGB_ALPHA_EXT:
             if (!context->getExtensions().sRGB)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             switch (type)
@@ -322,7 +322,7 @@
               case GL_UNSIGNED_BYTE:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -338,7 +338,7 @@
               case GL_UNSIGNED_INT:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -348,12 +348,12 @@
               case GL_UNSIGNED_INT_24_8_OES:
                 break;
               default:
-                context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
           default:
-            context->recordError(Error(GL_INVALID_ENUM));
+              context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
 
@@ -363,62 +363,62 @@
           case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
             if (context->getExtensions().textureCompressionDXT1)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
             if (context->getExtensions().textureCompressionDXT3)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
             if (context->getExtensions().textureCompressionDXT5)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_OES:
             if (context->getExtensions().compressedETC1RGB8Texture)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
               if (context->getExtensions().lossyETCDecode)
               {
-                  context->recordError(
+                  context->handleError(
                       Error(GL_INVALID_OPERATION,
                             "ETC1_RGB8_LOSSY_DECODE_ANGLE can't work with this type."));
                   return false;
               }
               else
               {
-                  context->recordError(
+                  context->handleError(
                       Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
                   return false;
               }
@@ -427,19 +427,19 @@
           case GL_DEPTH_STENCIL_OES:
             if (!context->getExtensions().depthTextures)
             {
-                context->recordError(Error(GL_INVALID_VALUE));
+                context->handleError(Error(GL_INVALID_VALUE));
                 return false;
             }
             if (target != GL_TEXTURE_2D)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             // OES_depth_texture supports loading depth data and multiple levels,
             // but ANGLE_depth_texture does not
             if (pixels != NULL || level != 0)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -451,7 +451,7 @@
         {
             if (!context->getExtensions().textureFloat)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
         }
@@ -459,7 +459,7 @@
         {
             if (!context->getExtensions().textureHalfFloat)
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
         }
@@ -485,7 +485,7 @@
 
     if (!ValidTexture2DDestinationTarget(context, target))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid texture target"));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid texture target"));
         return false;
     }
 
@@ -511,7 +511,7 @@
                 colorbufferFormat != GL_RGB5_A1 &&
                 colorbufferFormat != GL_RGBA8_OES)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -524,7 +524,7 @@
                   colorbufferFormat != GL_RGB5_A1 &&
                   colorbufferFormat != GL_RGBA8_OES)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -541,7 +541,7 @@
                   colorbufferFormat != GL_RGB32F &&
                   colorbufferFormat != GL_RGBA32F)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -556,7 +556,7 @@
                   colorbufferFormat != GL_RGB32F &&
                   colorbufferFormat != GL_RGBA32F)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -569,7 +569,7 @@
                 colorbufferFormat != GL_RGB32F &&
                 colorbufferFormat != GL_RGBA32F)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -580,7 +580,7 @@
                 colorbufferFormat != GL_RGBA8_OES &&
                 colorbufferFormat != GL_RGBA32F)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -590,21 +590,21 @@
           case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
           case GL_ETC1_RGB8_OES:
           case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
-            context->recordError(Error(GL_INVALID_OPERATION));
+              context->handleError(Error(GL_INVALID_OPERATION));
             return false;
           case GL_DEPTH_COMPONENT:
           case GL_DEPTH_STENCIL_OES:
-            context->recordError(Error(GL_INVALID_OPERATION));
+              context->handleError(Error(GL_INVALID_OPERATION));
             return false;
           default:
-            context->recordError(Error(GL_INVALID_OPERATION));
+              context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
 
         if (internalFormatInfo.type == GL_FLOAT &&
             !context->getExtensions().textureFloat)
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
     }
@@ -620,7 +620,7 @@
                 colorbufferFormat != GL_RGBA8_OES &&
                 colorbufferFormat != GL_BGR5_A1_ANGLEX)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -635,7 +635,7 @@
                   colorbufferFormat != GL_RGBA8_OES &&
                   colorbufferFormat != GL_BGR5_A1_ANGLEX)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -650,7 +650,7 @@
                   colorbufferFormat != GL_RGBA8_OES &&
                   colorbufferFormat != GL_BGR5_A1_ANGLEX)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -664,7 +664,7 @@
                   colorbufferFormat != GL_RGBA8_OES &&
                   colorbufferFormat != GL_BGR5_A1_ANGLEX)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION));
+                  context->handleError(Error(GL_INVALID_OPERATION));
                   return false;
               }
               break;
@@ -677,7 +677,7 @@
                 colorbufferFormat != GL_RGBA8_OES &&
                 colorbufferFormat != GL_BGR5_A1_ANGLEX)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -689,7 +689,7 @@
                 colorbufferFormat != GL_RGBA8_OES &&
                 colorbufferFormat != GL_BGR5_A1_ANGLEX)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             break;
@@ -697,61 +697,61 @@
           case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
             if (context->getExtensions().textureCompressionDXT1)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
             if (context->getExtensions().textureCompressionDXT3)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
             if (context->getExtensions().textureCompressionDXT5)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_OES:
             if (context->getExtensions().compressedETC1RGB8Texture)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
             break;
           case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
               if (context->getExtensions().lossyETCDecode)
               {
-                  context->recordError(Error(GL_INVALID_OPERATION,
+                  context->handleError(Error(GL_INVALID_OPERATION,
                                              "ETC1_RGB8_LOSSY_DECODE_ANGLE can't be copied to."));
                   return false;
               }
               else
               {
-                  context->recordError(
+                  context->handleError(
                       Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
                   return false;
               }
@@ -763,16 +763,16 @@
           case GL_DEPTH24_STENCIL8_OES:
             if (context->getExtensions().depthTextures)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
             else
             {
-                context->recordError(Error(GL_INVALID_ENUM));
+                context->handleError(Error(GL_INVALID_ENUM));
                 return false;
             }
           default:
-            context->recordError(Error(GL_INVALID_ENUM));
+              context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
     }
@@ -786,32 +786,32 @@
 {
     if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
     {
-        context->recordError(Error(GL_INVALID_ENUM));
+        context->handleError(Error(GL_INVALID_ENUM));
         return false;
     }
 
     if (width < 1 || height < 1 || levels < 1)
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
     if (target == GL_TEXTURE_CUBE_MAP && width != height)
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
     if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
     {
-        context->recordError(Error(GL_INVALID_OPERATION));
+        context->handleError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
     const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
     if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
     {
-        context->recordError(Error(GL_INVALID_ENUM));
+        context->handleError(Error(GL_INVALID_ENUM));
         return false;
     }
 
@@ -823,7 +823,7 @@
         if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
             static_cast<GLuint>(height) > caps.max2DTextureSize)
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
         break;
@@ -831,12 +831,12 @@
         if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize ||
             static_cast<GLuint>(height) > caps.maxCubeMapTextureSize)
         {
-            context->recordError(Error(GL_INVALID_VALUE));
+            context->handleError(Error(GL_INVALID_VALUE));
             return false;
         }
         break;
       default:
-        context->recordError(Error(GL_INVALID_ENUM));
+          context->handleError(Error(GL_INVALID_ENUM));
         return false;
     }
 
@@ -844,7 +844,7 @@
     {
         if (!gl::isPow2(width) || !gl::isPow2(height))
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
     }
@@ -855,35 +855,35 @@
       case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
         if (!context->getExtensions().textureCompressionDXT1)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
       case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
         if (!context->getExtensions().textureCompressionDXT3)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
       case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
         if (!context->getExtensions().textureCompressionDXT5)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
       case GL_ETC1_RGB8_OES:
         if (!context->getExtensions().compressedETC1RGB8Texture)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
       case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
           if (!context->getExtensions().lossyETCDecode)
           {
-              context->recordError(
+              context->handleError(
                   Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
               return false;
           }
@@ -895,7 +895,7 @@
       case GL_LUMINANCE_ALPHA32F_EXT:
         if (!context->getExtensions().textureFloat)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
@@ -906,7 +906,7 @@
       case GL_LUMINANCE_ALPHA16F_EXT:
         if (!context->getExtensions().textureHalfFloat)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
@@ -918,7 +918,7 @@
       case GL_RG32F_EXT:
         if (!context->getExtensions().textureRG)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         break;
@@ -927,18 +927,18 @@
       case GL_DEPTH24_STENCIL8_OES:
         if (!context->getExtensions().depthTextures)
         {
-            context->recordError(Error(GL_INVALID_ENUM));
+            context->handleError(Error(GL_INVALID_ENUM));
             return false;
         }
         if (target != GL_TEXTURE_2D)
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
         // ANGLE_depth_texture only supports 1-level textures
         if (levels != 1)
         {
-            context->recordError(Error(GL_INVALID_OPERATION));
+            context->handleError(Error(GL_INVALID_OPERATION));
             return false;
         }
         break;
@@ -949,13 +949,13 @@
     gl::Texture *texture = context->getTargetTexture(target);
     if (!texture || texture->id() == 0)
     {
-        context->recordError(Error(GL_INVALID_OPERATION));
+        context->handleError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
     if (texture->getImmutableFormat())
     {
-        context->recordError(Error(GL_INVALID_OPERATION));
+        context->handleError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
@@ -1013,7 +1013,7 @@
 {
     if (!context->getExtensions().discardFramebuffer)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1025,7 +1025,7 @@
         defaultFramebuffer = (context->getState().getTargetFramebuffer(GL_FRAMEBUFFER)->id() == 0);
         break;
       default:
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
+          context->handleError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
         return false;
     }
 
@@ -1036,7 +1036,7 @@
 {
     if (!context->getExtensions().vertexArrayObject)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1047,7 +1047,7 @@
 {
     if (!context->getExtensions().vertexArrayObject)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1058,7 +1058,7 @@
 {
     if (!context->getExtensions().vertexArrayObject)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1069,7 +1069,7 @@
 {
     if (!context->getExtensions().vertexArrayObject)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1084,7 +1084,7 @@
 {
     if (!context->getExtensions().getProgramBinary)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1100,7 +1100,7 @@
 {
     if (!context->getExtensions().getProgramBinary)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1172,25 +1172,25 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     if (!ValidDebugSource(source, false) && source != GL_DONT_CARE)
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
         return false;
     }
 
     if (!ValidDebugType(type) && type != GL_DONT_CARE)
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug type."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug type."));
         return false;
     }
 
     if (!ValidDebugSeverity(severity) && severity != GL_DONT_CARE)
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
         return false;
     }
 
@@ -1198,7 +1198,7 @@
     {
         if (source == GL_DONT_CARE || type == GL_DONT_CARE)
         {
-            context->recordError(Error(
+            context->handleError(Error(
                 GL_INVALID_OPERATION,
                 "If count is greater than zero, source and severity cannot be GL_DONT_CARE."));
             return false;
@@ -1206,7 +1206,7 @@
 
         if (severity != GL_DONT_CARE)
         {
-            context->recordError(
+            context->handleError(
                 Error(GL_INVALID_OPERATION,
                       "If count is greater than zero, severity must be GL_DONT_CARE."));
             return false;
@@ -1226,7 +1226,7 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1239,26 +1239,26 @@
 
     if (!ValidDebugSeverity(severity))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
         return false;
     }
 
     if (!ValidDebugType(type))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug type."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug type."));
         return false;
     }
 
     if (!ValidDebugSource(source, true))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
         return false;
     }
 
     size_t messageLength = (length < 0) ? strlen(buf) : length;
     if (messageLength > context->getExtensions().maxDebugMessageLength)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_VALUE, "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH."));
         return false;
     }
@@ -1272,7 +1272,7 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1291,13 +1291,13 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     if (bufSize < 0 && messageLog != nullptr)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_VALUE, "bufSize must be positive if messageLog is not null."));
         return false;
     }
@@ -1313,20 +1313,20 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     if (!ValidDebugSource(source, true))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
         return false;
     }
 
     size_t messageLength = (length < 0) ? strlen(message) : length;
     if (messageLength > context->getExtensions().maxDebugMessageLength)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_VALUE, "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH."));
         return false;
     }
@@ -1334,7 +1334,7 @@
     size_t currentStackSize = context->getState().getDebug().getGroupStackDepth();
     if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_STACK_OVERFLOW,
                   "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups."));
         return false;
@@ -1347,14 +1347,14 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     size_t currentStackSize = context->getState().getDebug().getGroupStackDepth();
     if (currentStackSize <= 1)
     {
-        context->recordError(Error(GL_STACK_UNDERFLOW, "Cannot pop the default debug group."));
+        context->handleError(Error(GL_STACK_UNDERFLOW, "Cannot pop the default debug group."));
         return false;
     }
 
@@ -1368,7 +1368,7 @@
         case GL_BUFFER:
             if (context->getBuffer(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid buffer."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid buffer."));
                 return false;
             }
             return true;
@@ -1376,7 +1376,7 @@
         case GL_SHADER:
             if (context->getShader(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid shader."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid shader."));
                 return false;
             }
             return true;
@@ -1384,7 +1384,7 @@
         case GL_PROGRAM:
             if (context->getProgram(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid program."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid program."));
                 return false;
             }
             return true;
@@ -1392,7 +1392,7 @@
         case GL_VERTEX_ARRAY:
             if (context->getVertexArray(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid vertex array."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid vertex array."));
                 return false;
             }
             return true;
@@ -1400,7 +1400,7 @@
         case GL_QUERY:
             if (context->getQuery(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid query."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid query."));
                 return false;
             }
             return true;
@@ -1408,7 +1408,7 @@
         case GL_TRANSFORM_FEEDBACK:
             if (context->getTransformFeedback(name) == nullptr)
             {
-                context->recordError(
+                context->handleError(
                     Error(GL_INVALID_VALUE, "name is not a valid transform feedback."));
                 return false;
             }
@@ -1417,7 +1417,7 @@
         case GL_SAMPLER:
             if (context->getSampler(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid sampler."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid sampler."));
                 return false;
             }
             return true;
@@ -1425,7 +1425,7 @@
         case GL_TEXTURE:
             if (context->getTexture(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid texture."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid texture."));
                 return false;
             }
             return true;
@@ -1433,7 +1433,7 @@
         case GL_RENDERBUFFER:
             if (context->getRenderbuffer(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid renderbuffer."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid renderbuffer."));
                 return false;
             }
             return true;
@@ -1441,13 +1441,13 @@
         case GL_FRAMEBUFFER:
             if (context->getFramebuffer(name) == nullptr)
             {
-                context->recordError(Error(GL_INVALID_VALUE, "name is not a valid framebuffer."));
+                context->handleError(Error(GL_INVALID_VALUE, "name is not a valid framebuffer."));
                 return false;
             }
             return true;
 
         default:
-            context->recordError(Error(GL_INVALID_ENUM, "Invalid identifier."));
+            context->handleError(Error(GL_INVALID_ENUM, "Invalid identifier."));
             return false;
     }
 
@@ -1462,7 +1462,7 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1474,7 +1474,7 @@
     size_t labelLength = (length < 0) ? strlen(label) : length;
     if (labelLength > context->getExtensions().maxLabelLength)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_VALUE, "Label length is larger than GL_MAX_LABEL_LENGTH."));
         return false;
     }
@@ -1491,13 +1491,13 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     if (bufSize < 0)
     {
-        context->recordError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
+        context->handleError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
         return false;
     }
 
@@ -1514,7 +1514,7 @@
 {
     if (context->getFenceSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr)
     {
-        context->recordError(Error(GL_INVALID_VALUE, "name is not a valid sync."));
+        context->handleError(Error(GL_INVALID_VALUE, "name is not a valid sync."));
         return false;
     }
 
@@ -1528,7 +1528,7 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1540,7 +1540,7 @@
     size_t labelLength = (length < 0) ? strlen(label) : length;
     if (labelLength > context->getExtensions().maxLabelLength)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_VALUE, "Label length is larger than GL_MAX_LABEL_LENGTH."));
         return false;
     }
@@ -1556,13 +1556,13 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
     if (bufSize < 0)
     {
-        context->recordError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
+        context->handleError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
         return false;
     }
 
@@ -1579,7 +1579,7 @@
 {
     if (!context->getExtensions().debug)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
         return false;
     }
 
@@ -1591,7 +1591,7 @@
             break;
 
         default:
-            context->recordError(Error(GL_INVALID_ENUM, "Invalid pname."));
+            context->handleError(Error(GL_INVALID_ENUM, "Invalid pname."));
             return false;
     }
 
@@ -1612,14 +1612,14 @@
 {
     if (!context->getExtensions().framebufferBlit)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Blit extension not available."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Blit extension not available."));
         return false;
     }
 
     if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
     {
         // TODO(jmadill): Determine if this should be available on other implementations.
-        context->recordError(Error(
+        context->handleError(Error(
             GL_INVALID_OPERATION,
             "Scaling and flipping in BlitFramebufferANGLE not supported by this implementation."));
         return false;
@@ -1627,7 +1627,7 @@
 
     if (filter == GL_LINEAR)
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Linear blit not supported in this extension"));
+        context->handleError(Error(GL_INVALID_ENUM, "Linear blit not supported in this extension"));
         return false;
     }
 
@@ -1646,7 +1646,7 @@
                 readColorAttachment->type() != GL_RENDERBUFFER &&
                 readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
 
@@ -1662,14 +1662,14 @@
                         attachment->type() != GL_RENDERBUFFER &&
                         attachment->type() != GL_FRAMEBUFFER_DEFAULT)
                     {
-                        context->recordError(Error(GL_INVALID_OPERATION));
+                        context->handleError(Error(GL_INVALID_OPERATION));
                         return false;
                     }
 
                     // Return an error if the destination formats do not match
                     if (attachment->getInternalFormat() != readColorAttachment->getInternalFormat())
                     {
-                        context->recordError(Error(GL_INVALID_OPERATION));
+                        context->handleError(Error(GL_INVALID_OPERATION));
                         return false;
                     }
                 }
@@ -1681,7 +1681,7 @@
                 IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
                               srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
             {
-                context->recordError(Error(GL_INVALID_OPERATION));
+                context->handleError(Error(GL_INVALID_OPERATION));
                 return false;
             }
         }
@@ -1707,13 +1707,13 @@
                     ERR(
                         "Only whole-buffer depth and stencil blits are supported by this "
                         "implementation.");
-                    context->recordError(Error(GL_INVALID_OPERATION));
+                    context->handleError(Error(GL_INVALID_OPERATION));
                     return false;
                 }
 
                 if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
                 {
-                    context->recordError(Error(GL_INVALID_OPERATION));
+                    context->handleError(Error(GL_INVALID_OPERATION));
                     return false;
                 }
             }
@@ -1731,13 +1731,13 @@
 
     if (framebufferObject->checkStatus(context->getData()) != GL_FRAMEBUFFER_COMPLETE)
     {
-        context->recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
         return false;
     }
 
     if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
@@ -1748,7 +1748,7 @@
 {
     if (!context->getExtensions().drawBuffers)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Extension not supported."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Extension not supported."));
         return false;
     }
 
@@ -1834,7 +1834,7 @@
         static_cast<GLuint>(imageSize) !=
             formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
@@ -1876,7 +1876,7 @@
         static_cast<GLuint>(imageSize) !=
             formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
     {
-        context->recordError(Error(GL_INVALID_VALUE));
+        context->handleError(Error(GL_INVALID_VALUE));
         return false;
     }
 
@@ -1887,7 +1887,7 @@
 {
     if (!context->getExtensions().mapBuffer)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
         return false;
     }
 
@@ -1898,13 +1898,13 @@
 {
     if (!context->getExtensions().mapBuffer)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
         return false;
     }
 
     if (!ValidBufferTarget(context, target))
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Invalid buffer target."));
+        context->handleError(Error(GL_INVALID_ENUM, "Invalid buffer target."));
         return false;
     }
 
@@ -1912,19 +1912,19 @@
 
     if (buffer == nullptr)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Attempted to map buffer object zero."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Attempted to map buffer object zero."));
         return false;
     }
 
     if (access != GL_WRITE_ONLY_OES)
     {
-        context->recordError(Error(GL_INVALID_ENUM, "Non-write buffer mapping not supported."));
+        context->handleError(Error(GL_INVALID_ENUM, "Non-write buffer mapping not supported."));
         return false;
     }
 
     if (buffer->isMapped())
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Buffer is already mapped."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Buffer is already mapped."));
         return false;
     }
 
@@ -1935,7 +1935,7 @@
 {
     if (!context->getExtensions().mapBuffer)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
+        context->handleError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
         return false;
     }
 
@@ -1950,7 +1950,7 @@
 {
     if (!context->getExtensions().mapBufferRange)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_OPERATION, "Map buffer range extension not available."));
         return false;
     }
@@ -1965,7 +1965,7 @@
 {
     if (!context->getExtensions().mapBufferRange)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_OPERATION, "Map buffer range extension not available."));
         return false;
     }
@@ -1978,7 +1978,7 @@
     Texture *textureObject = context->getTexture(texture);
     if (textureObject && textureObject->getTarget() != target && texture != 0)
     {
-        context->recordError(Error(GL_INVALID_OPERATION, "Invalid texture"));
+        context->handleError(Error(GL_INVALID_OPERATION, "Invalid texture"));
         return false;
     }
 
@@ -1992,20 +1992,20 @@
         case GL_TEXTURE_2D_ARRAY:
             if (context->getClientVersion() < 3)
             {
-                context->recordError(Error(GL_INVALID_ENUM, "GLES 3.0 disabled"));
+                context->handleError(Error(GL_INVALID_ENUM, "GLES 3.0 disabled"));
                 return false;
             }
             break;
         case GL_TEXTURE_EXTERNAL_OES:
             if (!context->getExtensions().eglStreamConsumerExternal)
             {
-                context->recordError(
+                context->handleError(
                     Error(GL_INVALID_ENUM, "External texture extension not enabled"));
                 return false;
             }
             break;
         default:
-            context->recordError(Error(GL_INVALID_ENUM, "Invalid target"));
+            context->handleError(Error(GL_INVALID_ENUM, "Invalid target"));
             return false;
     }
 
@@ -2019,7 +2019,7 @@
 {
     if (!context->getExtensions().bindUniformLocation)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_OPERATION, "GL_CHROMIUM_bind_uniform_location is not available."));
         return false;
     }
@@ -2032,7 +2032,7 @@
 
     if (location < 0)
     {
-        context->recordError(Error(GL_INVALID_VALUE, "Location cannot be less than 0."));
+        context->handleError(Error(GL_INVALID_VALUE, "Location cannot be less than 0."));
         return false;
     }
 
@@ -2040,7 +2040,7 @@
     if (static_cast<size_t>(location) >=
         (caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4)
     {
-        context->recordError(Error(GL_INVALID_VALUE,
+        context->handleError(Error(GL_INVALID_VALUE,
                                    "Location must be less than (MAX_VERTEX_UNIFORM_VECTORS + "
                                    "MAX_FRAGMENT_UNIFORM_VECTORS) * 4"));
         return false;
@@ -2048,7 +2048,7 @@
 
     if (strncmp(name, "gl_", 3) == 0)
     {
-        context->recordError(
+        context->handleError(
             Error(GL_INVALID_OPERATION, "Name cannot start with the reserved \"gl_\" prefix."));
         return false;
     }