[Reland] Move a few switches from GPU process commandline to GpuPreferences

Original review: https://chromium-review.googlesource.com/731064

BUG=774157
TEST=bots
[email protected]

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Iec41e916f4be93f8edef2b5dc006cd8fc6b8c201
Reviewed-on: https://chromium-review.googlesource.com/735832
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
Commit-Queue: Zhenyao Mo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#511347}
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index f3379fd..916aab2 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -191,7 +191,16 @@
       kTraceEventGpuProcessSortIndex);
 
   const base::CommandLine& command_line = parameters.command_line;
-  if (command_line.HasSwitch(switches::kGpuStartupDialog))
+
+  gpu::GpuPreferences gpu_preferences;
+  if (command_line.HasSwitch(switches::kGpuPreferences)) {
+    std::string value =
+        command_line.GetSwitchValueASCII(switches::kGpuPreferences);
+    bool success = gpu::SwitchValueToGpuPreferences(value, &gpu_preferences);
+    CHECK(success);
+  }
+
+  if (gpu_preferences.gpu_startup_dialog)
     WaitForDebugger("Gpu");
 
   base::Time start_time = base::Time::Now();
@@ -274,13 +283,6 @@
 
   gpu_init->set_sandbox_helper(&sandbox_helper);
 
-  gpu::GpuPreferences gpu_preferences;
-  if (command_line.HasSwitch(switches::kGpuPreferences)) {
-    std::string value =
-        command_line.GetSwitchValueASCII(switches::kGpuPreferences);
-    bool success = gpu::SwitchValueToGpuPreferences(value, &gpu_preferences);
-    CHECK(success);
-  }
   // Gpu initialization may fail for various reasons, in which case we will need
   // to tear down this process. However, we can not do so safely until the IPC
   // channel is set up, because the detection of early return of a child process