OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/leak_annotations.h" | 6 #include "base/debug/leak_annotations.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
9 #include "base/timer/hi_res_timer_manager.h" | 9 #include "base/timer/hi_res_timer_manager.h" |
10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 base::HighResolutionTimerManager hi_res_timer_manager; | 41 base::HighResolutionTimerManager hi_res_timer_manager; |
42 | 42 |
43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
44 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); | 44 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); |
45 if (!no_sandbox) { | 45 if (!no_sandbox) { |
46 sandbox::TargetServices* target_services = | 46 sandbox::TargetServices* target_services = |
47 parameters.sandbox_info->target_services; | 47 parameters.sandbox_info->target_services; |
48 if (!target_services) | 48 if (!target_services) |
49 return false; | 49 return false; |
| 50 #if defined(ADDRESS_SANITIZER) |
| 51 // Bind and leak dbghelp.dll before the token is lowered, otherwise |
| 52 // AddressSanitizer will crash when trying to symbolize a report. |
| 53 if (!LoadLibraryA("dbghelp.dll")) |
| 54 return false; |
| 55 #endif |
50 char buffer; | 56 char buffer; |
51 // Ensure RtlGenRandom is warm before the token is lowered; otherwise, | 57 // Ensure RtlGenRandom is warm before the token is lowered; otherwise, |
52 // base::RandBytes() will CHECK fail when v8 is initialized. | 58 // base::RandBytes() will CHECK fail when v8 is initialized. |
53 base::RandBytes(&buffer, sizeof(buffer)); | 59 base::RandBytes(&buffer, sizeof(buffer)); |
54 target_services->LowerToken(); | 60 target_services->LowerToken(); |
55 } | 61 } |
56 #endif | 62 #endif |
57 | 63 |
58 base::MessageLoop::current()->Run(); | 64 base::MessageLoop::current()->Run(); |
59 | 65 |
60 #if defined(LEAK_SANITIZER) | 66 #if defined(LEAK_SANITIZER) |
61 // Invoke LeakSanitizer before shutting down the utility thread, to avoid | 67 // Invoke LeakSanitizer before shutting down the utility thread, to avoid |
62 // reporting shutdown-only leaks. | 68 // reporting shutdown-only leaks. |
63 __lsan_do_leak_check(); | 69 __lsan_do_leak_check(); |
64 #endif | 70 #endif |
65 | 71 |
66 return 0; | 72 return 0; |
67 } | 73 } |
68 | 74 |
69 } // namespace content | 75 } // namespace content |
OLD | NEW |