Windows: On context lost, GPU process exits.

Some drivers cannot recover from device lost. IDirect3DDevice9::ResetEx returns an access denied error after a GPU hang. Although this results in a fallback to software, exiting the GPU process allows a newly launched GPU process to reinitialize D3D and GPU accelerated features continue to work.

I have observed this with an AMD driver but suspect there are issues with Intel from crash reports.

Review URL: https://chromiumcodereview.appspot.com/12617020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191705 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index ec5b2ab..a28bb4c 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2853,6 +2853,15 @@
 
   if (WasContextLost()) {
     LOG(ERROR) << "  GLES2DecoderImpl: Context lost during MakeCurrent.";
+
+    // Some D3D drivers cannot recover from device lost in the GPU process
+    // sandbox. Allow a new GPU process to launch.
+    if (workarounds().exit_on_context_lost) {
+      LOG(ERROR) << "Exiting GPU process because some drivers cannot reset"
+                 << " a D3D device in the Chrome GPU process sandbox.";
+      exit(0);
+    }
+
     return false;
   }