OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 !CommandLine::ForCurrentProcess()->HasSwitch( | 124 !CommandLine::ForCurrentProcess()->HasSwitch( |
125 switches::kDisableGpuWatchdog) && | 125 switches::kDisableGpuWatchdog) && |
126 !RunningOnValgrind(); | 126 !RunningOnValgrind(); |
127 | 127 |
128 // Disable the watchdog in debug builds because they tend to only be run by | 128 // Disable the watchdog in debug builds because they tend to only be run by |
129 // developers who will not appreciate the watchdog killing the GPU process. | 129 // developers who will not appreciate the watchdog killing the GPU process. |
130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
131 enable_watchdog = false; | 131 enable_watchdog = false; |
132 #endif | 132 #endif |
133 | 133 |
| 134 bool delayed_watchdog_enable = false; |
| 135 |
| 136 #if defined(OS_CHROMEOS) |
| 137 // Don't start watchdog immediately, to allow developers to switch to VT2 on |
| 138 // startup. |
| 139 delayed_watchdog_enable = true; |
| 140 #endif |
| 141 |
134 scoped_refptr<GpuWatchdogThread> watchdog_thread; | 142 scoped_refptr<GpuWatchdogThread> watchdog_thread; |
135 | 143 |
136 // Start the GPU watchdog only after anything that is expected to be time | 144 // Start the GPU watchdog only after anything that is expected to be time |
137 // consuming has completed, otherwise the process is liable to be aborted. | 145 // consuming has completed, otherwise the process is liable to be aborted. |
138 if (enable_watchdog) { | 146 if (enable_watchdog && !delayed_watchdog_enable) { |
139 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); | 147 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); |
140 watchdog_thread->Start(); | 148 watchdog_thread->Start(); |
141 } | 149 } |
142 | 150 |
143 GPUInfo gpu_info; | 151 GPUInfo gpu_info; |
144 // Get vendor_id, device_id, driver_version from browser process through | 152 // Get vendor_id, device_id, driver_version from browser process through |
145 // commandline switches. | 153 // commandline switches. |
146 DCHECK(command_line.HasSwitch(switches::kGpuVendorID) && | 154 DCHECK(command_line.HasSwitch(switches::kGpuVendorID) && |
147 command_line.HasSwitch(switches::kGpuDeviceID) && | 155 command_line.HasSwitch(switches::kGpuDeviceID) && |
148 command_line.HasSwitch(switches::kGpuDriverVersion)); | 156 command_line.HasSwitch(switches::kGpuDriverVersion)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 192 } |
185 } | 193 } |
186 #endif // OS_CHROMEOS | 194 #endif // OS_CHROMEOS |
187 } else { | 195 } else { |
188 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 196 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
189 gpu_info.gpu_accessible = false; | 197 gpu_info.gpu_accessible = false; |
190 gpu_info.finalized = true; | 198 gpu_info.finalized = true; |
191 dead_on_arrival = true; | 199 dead_on_arrival = true; |
192 } | 200 } |
193 | 201 |
| 202 if (enable_watchdog && delayed_watchdog_enable) { |
| 203 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); |
| 204 watchdog_thread->Start(); |
| 205 } |
| 206 |
194 // OSMesa is expected to run very slowly, so disable the watchdog in that | 207 // OSMesa is expected to run very slowly, so disable the watchdog in that |
195 // case. | 208 // case. |
196 if (enable_watchdog && | 209 if (enable_watchdog && |
197 gfx::GetGLImplementation() == gfx::kGLImplementationOSMesaGL) { | 210 gfx::GetGLImplementation() == gfx::kGLImplementationOSMesaGL) { |
198 watchdog_thread->Stop(); | 211 watchdog_thread->Stop(); |
199 | 212 |
200 watchdog_thread = NULL; | 213 watchdog_thread = NULL; |
201 } | 214 } |
202 | 215 |
203 { | 216 { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 TRACE_EVENT0("gpu", "Initialize DXVA"); | 353 TRACE_EVENT0("gpu", "Initialize DXVA"); |
341 // Initialize H/W video decoding stuff which fails in the sandbox. | 354 // Initialize H/W video decoding stuff which fails in the sandbox. |
342 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 355 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
343 } | 356 } |
344 #endif | 357 #endif |
345 } | 358 } |
346 | 359 |
347 } // namespace. | 360 } // namespace. |
348 | 361 |
349 } // namespace content | 362 } // namespace content |
OLD | NEW |