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 | |
56 char buffer; | 50 char buffer; |
57 // Ensure RtlGenRandom is warm before the token is lowered; otherwise, | 51 // Ensure RtlGenRandom is warm before the token is lowered; otherwise, |
58 // base::RandBytes() will CHECK fail when v8 is initialized. | 52 // base::RandBytes() will CHECK fail when v8 is initialized. |
59 base::RandBytes(&buffer, sizeof(buffer)); | 53 base::RandBytes(&buffer, sizeof(buffer)); |
60 target_services->LowerToken(); | 54 target_services->LowerToken(); |
61 } | 55 } |
62 #endif | 56 #endif |
63 | 57 |
64 base::MessageLoop::current()->Run(); | 58 base::MessageLoop::current()->Run(); |
65 | 59 |
66 #if defined(LEAK_SANITIZER) | 60 #if defined(LEAK_SANITIZER) |
67 // Invoke LeakSanitizer before shutting down the utility thread, to avoid | 61 // Invoke LeakSanitizer before shutting down the utility thread, to avoid |
68 // reporting shutdown-only leaks. | 62 // reporting shutdown-only leaks. |
69 __lsan_do_leak_check(); | 63 __lsan_do_leak_check(); |
70 #endif | 64 #endif |
71 | 65 |
72 return 0; | 66 return 0; |
73 } | 67 } |
74 | 68 |
75 } // namespace content | 69 } // namespace content |
OLD | NEW |