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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 396 |
397 bool StartSandboxLinux(const gpu::GPUInfo& gpu_info, | 397 bool StartSandboxLinux(const gpu::GPUInfo& gpu_info, |
398 GpuWatchdogThread* watchdog_thread, | 398 GpuWatchdogThread* watchdog_thread, |
399 bool should_initialize_gl_context) { | 399 bool should_initialize_gl_context) { |
400 TRACE_EVENT0("gpu", "Initialize sandbox"); | 400 TRACE_EVENT0("gpu", "Initialize sandbox"); |
401 | 401 |
402 bool res = false; | 402 bool res = false; |
403 | 403 |
404 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); | 404 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); |
405 | 405 |
406 if (watchdog_thread) | 406 if (watchdog_thread) { |
407 watchdog_thread->Stop(); | 407 // LinuxSandbox needs to be able to ensure that the thread |
| 408 // has really been stopped. |
| 409 LinuxSandbox::StopThread(watchdog_thread); |
| 410 } |
408 // LinuxSandbox::InitializeSandbox() must always be called | 411 // LinuxSandbox::InitializeSandbox() must always be called |
409 // with only one thread. | 412 // with only one thread. |
410 res = LinuxSandbox::InitializeSandbox(); | 413 res = LinuxSandbox::InitializeSandbox(); |
411 if (watchdog_thread) | 414 if (watchdog_thread) { |
412 watchdog_thread->Start(); | 415 watchdog_thread->Start(); |
| 416 } |
413 | 417 |
414 return res; | 418 return res; |
415 } | 419 } |
416 #endif // defined(OS_LINUX) | 420 #endif // defined(OS_LINUX) |
417 | 421 |
418 #if defined(OS_WIN) | 422 #if defined(OS_WIN) |
419 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { | 423 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { |
420 TRACE_EVENT0("gpu", "Lower token"); | 424 TRACE_EVENT0("gpu", "Lower token"); |
421 | 425 |
422 // For Windows, if the target_services interface is not zero, the process | 426 // For Windows, if the target_services interface is not zero, the process |
423 // is sandboxed and we must call LowerToken() before rendering untrusted | 427 // is sandboxed and we must call LowerToken() before rendering untrusted |
424 // content. | 428 // content. |
425 sandbox::TargetServices* target_services = sandbox_info->target_services; | 429 sandbox::TargetServices* target_services = sandbox_info->target_services; |
426 if (target_services) { | 430 if (target_services) { |
427 target_services->LowerToken(); | 431 target_services->LowerToken(); |
428 return true; | 432 return true; |
429 } | 433 } |
430 | 434 |
431 return false; | 435 return false; |
432 } | 436 } |
433 #endif // defined(OS_WIN) | 437 #endif // defined(OS_WIN) |
434 | 438 |
435 } // namespace. | 439 } // namespace. |
436 | 440 |
437 } // namespace content | 441 } // namespace content |
OLD | NEW |