| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 bool StartSandboxLinux(const gpu::GPUInfo& gpu_info, | 416 bool StartSandboxLinux(const gpu::GPUInfo& gpu_info, |
| 417 GpuWatchdogThread* watchdog_thread, | 417 GpuWatchdogThread* watchdog_thread, |
| 418 bool should_initialize_gl_context) { | 418 bool should_initialize_gl_context) { |
| 419 TRACE_EVENT0("gpu", "Initialize sandbox"); | 419 TRACE_EVENT0("gpu", "Initialize sandbox"); |
| 420 | 420 |
| 421 bool res = false; | 421 bool res = false; |
| 422 | 422 |
| 423 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); | 423 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); |
| 424 | 424 |
| 425 if (watchdog_thread) | 425 if (watchdog_thread) { |
| 426 watchdog_thread->Stop(); | 426 // LinuxSandbox needs to be able to ensure that the thread |
| 427 // has really been stopped. |
| 428 LinuxSandbox::StopThread(watchdog_thread); |
| 429 } |
| 427 // LinuxSandbox::InitializeSandbox() must always be called | 430 // LinuxSandbox::InitializeSandbox() must always be called |
| 428 // with only one thread. | 431 // with only one thread. |
| 429 res = LinuxSandbox::InitializeSandbox(); | 432 res = LinuxSandbox::InitializeSandbox(); |
| 430 if (watchdog_thread) | 433 if (watchdog_thread) { |
| 431 watchdog_thread->Start(); | 434 watchdog_thread->Start(); |
| 435 } |
| 432 | 436 |
| 433 return res; | 437 return res; |
| 434 } | 438 } |
| 435 #endif // defined(OS_LINUX) | 439 #endif // defined(OS_LINUX) |
| 436 | 440 |
| 437 #if defined(OS_WIN) | 441 #if defined(OS_WIN) |
| 438 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { | 442 bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) { |
| 439 TRACE_EVENT0("gpu", "Lower token"); | 443 TRACE_EVENT0("gpu", "Lower token"); |
| 440 | 444 |
| 441 // For Windows, if the target_services interface is not zero, the process | 445 // For Windows, if the target_services interface is not zero, the process |
| 442 // is sandboxed and we must call LowerToken() before rendering untrusted | 446 // is sandboxed and we must call LowerToken() before rendering untrusted |
| 443 // content. | 447 // content. |
| 444 sandbox::TargetServices* target_services = sandbox_info->target_services; | 448 sandbox::TargetServices* target_services = sandbox_info->target_services; |
| 445 if (target_services) { | 449 if (target_services) { |
| 446 target_services->LowerToken(); | 450 target_services->LowerToken(); |
| 447 return true; | 451 return true; |
| 448 } | 452 } |
| 449 | 453 |
| 450 return false; | 454 return false; |
| 451 } | 455 } |
| 452 #endif // defined(OS_WIN) | 456 #endif // defined(OS_WIN) |
| 453 | 457 |
| 454 } // namespace. | 458 } // namespace. |
| 455 | 459 |
| 456 } // namespace content | 460 } // namespace content |
| OLD | NEW |