| 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 12 matching lines...) Expand all Loading... |
| 23 // Mainline routine for running as the utility process. | 23 // Mainline routine for running as the utility process. |
| 24 int UtilityMain(const MainFunctionParams& parameters) { | 24 int UtilityMain(const MainFunctionParams& parameters) { |
| 25 // The main message loop of the utility process. | 25 // The main message loop of the utility process. |
| 26 base::MessageLoop main_message_loop; | 26 base::MessageLoop main_message_loop; |
| 27 base::PlatformThread::SetName("CrUtilityMain"); | 27 base::PlatformThread::SetName("CrUtilityMain"); |
| 28 | 28 |
| 29 #if defined(OS_LINUX) | 29 #if defined(OS_LINUX) |
| 30 // Initializes the sandbox before any threads are created. | 30 // Initializes the sandbox before any threads are created. |
| 31 // TODO(jorgelo): move this after GTK initialization when we enable a strict | 31 // TODO(jorgelo): move this after GTK initialization when we enable a strict |
| 32 // Seccomp-BPF policy. | 32 // Seccomp-BPF policy. |
| 33 LinuxSandbox::InitializeSandbox(); | 33 if (parameters.zygote_child) |
| 34 LinuxSandbox::InitializeSandbox(); |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 ChildProcess utility_process; | 37 ChildProcess utility_process; |
| 37 utility_process.set_main_thread(new UtilityThreadImpl()); | 38 utility_process.set_main_thread(new UtilityThreadImpl()); |
| 38 | 39 |
| 39 base::HighResolutionTimerManager hi_res_timer_manager; | 40 base::HighResolutionTimerManager hi_res_timer_manager; |
| 40 | 41 |
| 41 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 42 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); | 43 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); |
| 43 if (!no_sandbox) { | 44 if (!no_sandbox) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 #if defined(LEAK_SANITIZER) | 55 #if defined(LEAK_SANITIZER) |
| 55 // Invoke LeakSanitizer before shutting down the utility thread, to avoid | 56 // Invoke LeakSanitizer before shutting down the utility thread, to avoid |
| 56 // reporting shutdown-only leaks. | 57 // reporting shutdown-only leaks. |
| 57 __lsan_do_leak_check(); | 58 __lsan_do_leak_check(); |
| 58 #endif | 59 #endif |
| 59 | 60 |
| 60 return 0; | 61 return 0; |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace content | 64 } // namespace content |
| OLD | NEW |