Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if defined(USE_X11) | 46 #if defined(USE_X11) |
| 47 #include "ui/base/x/x11_util.h" | 47 #include "ui/base/x/x11_util.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_LINUX) | 50 #if defined(OS_LINUX) |
| 51 #include "content/public/common/sandbox_init.h" | 51 #include "content/public/common/sandbox_init.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if defined(ADDRESS_SANITIZER) | |
| 55 #include <sanitizer/asan_interface.h> | |
| 56 #endif | |
| 57 | |
| 54 const int kGpuTimeout = 10000; | 58 const int kGpuTimeout = 10000; |
| 55 | 59 |
| 56 namespace content { | 60 namespace content { |
| 57 | 61 |
| 58 namespace { | 62 namespace { |
| 59 | 63 |
| 60 bool WarmUpSandbox(const CommandLine& command_line); | 64 bool WarmUpSandbox(const CommandLine& command_line); |
| 61 #if defined(OS_LINUX) | 65 #if defined(OS_LINUX) |
| 62 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); | 66 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); |
| 63 #elif defined(OS_WIN) | 67 #elif defined(OS_WIN) |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 | 423 |
| 420 bool res = false; | 424 bool res = false; |
| 421 | 425 |
| 422 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); | 426 WarmUpSandboxNvidia(gpu_info, should_initialize_gl_context); |
| 423 | 427 |
| 424 if (watchdog_thread) { | 428 if (watchdog_thread) { |
| 425 // LinuxSandbox needs to be able to ensure that the thread | 429 // LinuxSandbox needs to be able to ensure that the thread |
| 426 // has really been stopped. | 430 // has really been stopped. |
| 427 LinuxSandbox::StopThread(watchdog_thread); | 431 LinuxSandbox::StopThread(watchdog_thread); |
| 428 } | 432 } |
| 433 | |
| 434 #if defined(ADDRESS_SANITIZER) | |
| 435 LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); | |
| 436 struct __sanitizer_sandbox_arguments* sanitizer_args = | |
| 437 new struct __sanitizer_sandbox_arguments; | |
| 438 memset(sanitizer_args, 0, sizeof(*sanitizer_args)); | |
|
jln (very slow on Chromium)
2014/05/13 01:17:35
*sanitizer_args = {0}; instead?
earthdok
2014/05/14 17:00:26
Done.
| |
| 439 sanitizer_args->coverage_sandboxed = 1; | |
| 440 sanitizer_args->coverage_fd = -1; | |
| 441 | |
| 442 linux_sandbox->SetSanitizerArgs(sanitizer_args); | |
| 443 #endif | |
| 444 | |
| 429 // LinuxSandbox::InitializeSandbox() must always be called | 445 // LinuxSandbox::InitializeSandbox() must always be called |
| 430 // with only one thread. | 446 // with only one thread. |
| 431 res = LinuxSandbox::InitializeSandbox(); | 447 res = LinuxSandbox::InitializeSandbox(); |
| 432 if (watchdog_thread) { | 448 if (watchdog_thread) { |
| 433 watchdog_thread->Start(); | 449 watchdog_thread->Start(); |
| 434 } | 450 } |
| 435 | 451 |
| 436 return res; | 452 return res; |
| 437 } | 453 } |
| 438 #endif // defined(OS_LINUX) | 454 #endif // defined(OS_LINUX) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 450 return true; | 466 return true; |
| 451 } | 467 } |
| 452 | 468 |
| 453 return false; | 469 return false; |
| 454 } | 470 } |
| 455 #endif // defined(OS_WIN) | 471 #endif // defined(OS_WIN) |
| 456 | 472 |
| 457 } // namespace. | 473 } // namespace. |
| 458 | 474 |
| 459 } // namespace content | 475 } // namespace content |
| OLD | NEW |