Skip CallDeferredErrorCallbacks if no deferred error

In current Deferred Error Callback implementation, CallDeferredErrorCallbacks
will be invoked in every GPU_CLIENT_SINGLE_THREAD_CHECK().

Current implementation of CallDeferredErrorCallbacks will do extra deque created
and swap operation even there is no errors. This impact performance.

This patch fixed this by adding a flag and skip CallDeferredErrorCallbacks if there are no errors.

Bug: 862069
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ie64aca137ac20bd7a19895a9dafed2a1744348ae
Reviewed-on: https://chromium-review.googlesource.com/1131010
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Cr-Commit-Position: refs/heads/master@{#575527}
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 03c0960..09c5ef3 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -390,6 +390,9 @@
 }
 
 void GLES2Implementation::CallDeferredErrorCallbacks() {
+  if (deferred_error_callbacks_.empty())
+    return;
+
   if (error_message_callback_.is_null()) {
     // User probably cleared this out.
     deferred_error_callbacks_.clear();