Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: gpu/ipc/service/gpu_init.cc

Issue 2857743004: Workaround for UCRT deadlock between gpu's main and watchdog threads (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "gpu/ipc/service/gpu_init.h" 5 #include "gpu/ipc/service/gpu_init.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool delayed_watchdog_enable = false; 156 bool delayed_watchdog_enable = false;
157 157
158 #if defined(OS_CHROMEOS) 158 #if defined(OS_CHROMEOS)
159 // Don't start watchdog immediately, to allow developers to switch to VT2 on 159 // Don't start watchdog immediately, to allow developers to switch to VT2 on
160 // startup. 160 // startup.
161 delayed_watchdog_enable = true; 161 delayed_watchdog_enable = true;
162 #endif 162 #endif
163 163
164 // Start the GPU watchdog only after anything that is expected to be time 164 // Start the GPU watchdog only after anything that is expected to be time
165 // consuming has completed, otherwise the process is liable to be aborted. 165 // consuming has completed, otherwise the process is liable to be aborted.
166 if (enable_watchdog && !delayed_watchdog_enable) 166 if (enable_watchdog && !delayed_watchdog_enable) {
167 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); 167 watchdog_thread_ = gpu::GpuWatchdogThread::Create();
168 #if defined(OS_WIN)
169 // This is a workaround for an occasional deadlock between watchdog and
170 // current thread. Watchdog hangs at thread initialization in
171 // __acrt_thread_attach() and current thread in std::setlocale(...)
172 // (during InitializeGLOneOff()). Source of the deadlock looks like an old
173 // UCRT bug that was supposed to be fixed in 10.0.10586 release of UCRT,
174 // but we might have come accross a not-yet-covered scenario.
Ken Russell (switch to Gerrit) 2017/05/04 17:18:48 Please refer to crbug.com/718388 in the comment, i
175 // References:
176 // https://bugs.python.org/issue26624
177 // http://stackoverflow.com/questions/35572792/setlocale-stuck-on-windows
178 auto watchdog_started = watchdog_thread_->WaitUntilThreadStarted();
179 DCHECK(watchdog_started);
180 #endif // OS_WIN
181 }
168 182
169 // Get vendor_id, device_id, driver_version from browser process through 183 // Get vendor_id, device_id, driver_version from browser process through
170 // commandline switches. 184 // commandline switches.
171 GetGpuInfoFromCommandLine(gpu_info_, command_line); 185 GetGpuInfoFromCommandLine(gpu_info_, command_line);
172 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 186 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
173 if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA 187 if (gpu_info_.gpu.vendor_id == 0x10de && // NVIDIA
174 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile()) 188 gpu_info_.driver_vendor == "NVIDIA" && !CanAccessNvidiaDeviceFile())
175 return false; 189 return false;
176 #endif 190 #endif
177 gpu_info_.in_process_gpu = false; 191 gpu_info_.in_process_gpu = false;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 278
265 if (!gpu_info_.sandboxed && !attempted_startsandbox) { 279 if (!gpu_info_.sandboxed && !attempted_startsandbox) {
266 gpu_info_.sandboxed = 280 gpu_info_.sandboxed =
267 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); 281 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get());
268 } 282 }
269 283
270 return true; 284 return true;
271 } 285 }
272 286
273 } // namespace gpu 287 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698