Don't use GLStateRestorer with the passthrough command decoder.

The passthrough command decoder does not implement the state restoration
functions because it does not track state. When a GLStateRestorer
exists, it is used for the scoped binders in ui/gl/scoped_binders.h and
leads to incorrect state being applied.

BUG=88258

Change-Id: I18937597fc02562dfaf01d67a9d4a1b8b84290a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670949
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672107}
diff --git a/gpu/ipc/service/gles2_command_buffer_stub.cc b/gpu/ipc/service/gles2_command_buffer_stub.cc
index 92cf96b..28cc844 100644
--- a/gpu/ipc/service/gles2_command_buffer_stub.cc
+++ b/gpu/ipc/service/gles2_command_buffer_stub.cc
@@ -329,7 +329,11 @@
     return gpu::ContextResult::kTransientFailure;
   }
 
-  if (!context->GetGLStateRestorer()) {
+  // The GLStateRestorer is not used with the passthrough command decoder
+  // because not all state is tracked in the decoder. Virtualized contexts are
+  // also not used.
+  if (!context->GetGLStateRestorer() &&
+      !context_group_->use_passthrough_cmd_decoder()) {
     context->SetGLStateRestorer(
         new GLStateRestorerImpl(gles2_decoder_->AsWeakPtr()));
   }