| 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/feature_list.h" | |
| 8 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 9 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 10 #include "base/timer/hi_res_timer_manager.h" | 9 #include "base/timer/hi_res_timer_manager.h" |
| 11 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 12 #include "content/child/child_process.h" | 11 #include "content/child/child_process.h" |
| 13 #include "content/common/sandbox_linux/sandbox_linux.h" | 12 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 14 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/common/main_function_params.h" | 14 #include "content/public/common/main_function_params.h" |
| 16 #include "content/public/common/sandbox_init.h" | 15 #include "content/public/common/sandbox_init.h" |
| 17 #include "content/utility/utility_thread_impl.h" | 16 #include "content/utility/utility_thread_impl.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 base::PlatformThread::SetName("CrUtilityMain"); | 29 base::PlatformThread::SetName("CrUtilityMain"); |
| 31 | 30 |
| 32 #if defined(OS_LINUX) | 31 #if defined(OS_LINUX) |
| 33 // Initializes the sandbox before any threads are created. | 32 // Initializes the sandbox before any threads are created. |
| 34 // TODO(jorgelo): move this after GTK initialization when we enable a strict | 33 // TODO(jorgelo): move this after GTK initialization when we enable a strict |
| 35 // Seccomp-BPF policy. | 34 // Seccomp-BPF policy. |
| 36 if (parameters.zygote_child) | 35 if (parameters.zygote_child) |
| 37 LinuxSandbox::InitializeSandbox(); | 36 LinuxSandbox::InitializeSandbox(); |
| 38 #endif | 37 #endif |
| 39 | 38 |
| 40 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | |
| 41 feature_list->InitializeFromCommandLine( | |
| 42 parameters.command_line.GetSwitchValueASCII(switches::kEnableFeatures), | |
| 43 parameters.command_line.GetSwitchValueASCII(switches::kDisableFeatures)); | |
| 44 base::FeatureList::SetInstance(std::move(feature_list)); | |
| 45 | |
| 46 ChildProcess utility_process; | 39 ChildProcess utility_process; |
| 47 utility_process.set_main_thread(new UtilityThreadImpl()); | 40 utility_process.set_main_thread(new UtilityThreadImpl()); |
| 48 | 41 |
| 49 base::HighResolutionTimerManager hi_res_timer_manager; | 42 base::HighResolutionTimerManager hi_res_timer_manager; |
| 50 | 43 |
| 51 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 52 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); | 45 bool no_sandbox = parameters.command_line.HasSwitch(switches::kNoSandbox); |
| 53 if (!no_sandbox) { | 46 if (!no_sandbox) { |
| 54 sandbox::TargetServices* target_services = | 47 sandbox::TargetServices* target_services = |
| 55 parameters.sandbox_info->target_services; | 48 parameters.sandbox_info->target_services; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 #if defined(LEAK_SANITIZER) | 61 #if defined(LEAK_SANITIZER) |
| 69 // Invoke LeakSanitizer before shutting down the utility thread, to avoid | 62 // Invoke LeakSanitizer before shutting down the utility thread, to avoid |
| 70 // reporting shutdown-only leaks. | 63 // reporting shutdown-only leaks. |
| 71 __lsan_do_leak_check(); | 64 __lsan_do_leak_check(); |
| 72 #endif | 65 #endif |
| 73 | 66 |
| 74 return 0; | 67 return 0; |
| 75 } | 68 } |
| 76 | 69 |
| 77 } // namespace content | 70 } // namespace content |
| OLD | NEW |