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 <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // startup. | 199 // startup. |
200 delayed_watchdog_enable = true; | 200 delayed_watchdog_enable = true; |
201 #endif | 201 #endif |
202 | 202 |
203 scoped_refptr<GpuWatchdogThread> watchdog_thread; | 203 scoped_refptr<GpuWatchdogThread> watchdog_thread; |
204 | 204 |
205 // Start the GPU watchdog only after anything that is expected to be time | 205 // Start the GPU watchdog only after anything that is expected to be time |
206 // consuming has completed, otherwise the process is liable to be aborted. | 206 // consuming has completed, otherwise the process is liable to be aborted. |
207 if (enable_watchdog && !delayed_watchdog_enable) { | 207 if (enable_watchdog && !delayed_watchdog_enable) { |
208 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); | 208 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); |
209 watchdog_thread->Start(); | 209 base::Thread::Options options; |
| 210 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 211 watchdog_thread->StartWithOptions(options); |
210 } | 212 } |
211 | 213 |
212 gpu::GPUInfo gpu_info; | 214 gpu::GPUInfo gpu_info; |
213 // Get vendor_id, device_id, driver_version from browser process through | 215 // Get vendor_id, device_id, driver_version from browser process through |
214 // commandline switches. | 216 // commandline switches. |
215 GetGpuInfoFromCommandLine(gpu_info, command_line); | 217 GetGpuInfoFromCommandLine(gpu_info, command_line); |
216 | 218 |
217 base::TimeDelta collect_context_time; | 219 base::TimeDelta collect_context_time; |
218 base::TimeDelta initialize_one_off_time; | 220 base::TimeDelta initialize_one_off_time; |
219 | 221 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } else { // gl_initialized | 295 } else { // gl_initialized |
294 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; | 296 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; |
295 dead_on_arrival = true; | 297 dead_on_arrival = true; |
296 } | 298 } |
297 | 299 |
298 initialize_one_off_time = | 300 initialize_one_off_time = |
299 base::TimeTicks::Now() - before_initialize_one_off; | 301 base::TimeTicks::Now() - before_initialize_one_off; |
300 | 302 |
301 if (enable_watchdog && delayed_watchdog_enable) { | 303 if (enable_watchdog && delayed_watchdog_enable) { |
302 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); | 304 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); |
303 watchdog_thread->Start(); | 305 base::Thread::Options options; |
| 306 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 307 watchdog_thread->StartWithOptions(options); |
304 } | 308 } |
305 | 309 |
306 // OSMesa is expected to run very slowly, so disable the watchdog in that | 310 // OSMesa is expected to run very slowly, so disable the watchdog in that |
307 // case. | 311 // case. |
308 if (enable_watchdog && | 312 if (enable_watchdog && |
309 gfx::GetGLImplementation() == gfx::kGLImplementationOSMesaGL) { | 313 gfx::GetGLImplementation() == gfx::kGLImplementationOSMesaGL) { |
310 watchdog_thread->Stop(); | 314 watchdog_thread->Stop(); |
311 watchdog_thread = NULL; | 315 watchdog_thread = NULL; |
312 } | 316 } |
313 | 317 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 linux_sandbox->sanitizer_args()->coverage_sandboxed = 1; | 492 linux_sandbox->sanitizer_args()->coverage_sandboxed = 1; |
489 linux_sandbox->sanitizer_args()->coverage_fd = | 493 linux_sandbox->sanitizer_args()->coverage_fd = |
490 __sanitizer_maybe_open_cov_file(sancov_file_name.c_str()); | 494 __sanitizer_maybe_open_cov_file(sancov_file_name.c_str()); |
491 linux_sandbox->sanitizer_args()->coverage_max_block_size = 0; | 495 linux_sandbox->sanitizer_args()->coverage_max_block_size = 0; |
492 #endif | 496 #endif |
493 | 497 |
494 // LinuxSandbox::InitializeSandbox() must always be called | 498 // LinuxSandbox::InitializeSandbox() must always be called |
495 // with only one thread. | 499 // with only one thread. |
496 res = LinuxSandbox::InitializeSandbox(); | 500 res = LinuxSandbox::InitializeSandbox(); |
497 if (watchdog_thread) { | 501 if (watchdog_thread) { |
498 watchdog_thread->Start(); | 502 base::Thread::Options options; |
| 503 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 504 watchdog_thread->StartWithOptions(options); |
499 } | 505 } |
500 | 506 |
501 return res; | 507 return res; |
502 } | 508 } |
503 #endif // defined(OS_LINUX) | 509 #endif // defined(OS_LINUX) |
504 | 510 |
505 #if defined(OS_WIN) | 511 #if defined(OS_WIN) |
506 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { | 512 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { |
507 TRACE_EVENT0("gpu", "Lower token"); | 513 TRACE_EVENT0("gpu", "Lower token"); |
508 | 514 |
509 // For Windows, if the target_services interface is not zero, the process | 515 // For Windows, if the target_services interface is not zero, the process |
510 // is sandboxed and we must call LowerToken() before rendering untrusted | 516 // is sandboxed and we must call LowerToken() before rendering untrusted |
511 // content. | 517 // content. |
512 sandbox::TargetServices* target_services = sandbox_info->target_services; | 518 sandbox::TargetServices* target_services = sandbox_info->target_services; |
513 if (target_services) { | 519 if (target_services) { |
514 target_services->LowerToken(); | 520 target_services->LowerToken(); |
515 return true; | 521 return true; |
516 } | 522 } |
517 | 523 |
518 return false; | 524 return false; |
519 } | 525 } |
520 #endif // defined(OS_WIN) | 526 #endif // defined(OS_WIN) |
521 | 527 |
522 } // namespace. | 528 } // namespace. |
523 | 529 |
524 } // namespace content | 530 } // namespace content |
OLD | NEW |