| 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 "content/zygote/zygote_main.h" | 5 #include "content/zygote/zygote_main.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "base/pickle.h" | 29 #include "base/pickle.h" |
| 30 #include "base/posix/eintr_wrapper.h" | 30 #include "base/posix/eintr_wrapper.h" |
| 31 #include "base/posix/unix_domain_socket_linux.h" | 31 #include "base/posix/unix_domain_socket_linux.h" |
| 32 #include "base/rand_util.h" | 32 #include "base/rand_util.h" |
| 33 #include "base/strings/safe_sprintf.h" | 33 #include "base/strings/safe_sprintf.h" |
| 34 #include "base/strings/string_number_conversions.h" | 34 #include "base/strings/string_number_conversions.h" |
| 35 #include "base/sys_info.h" | 35 #include "base/sys_info.h" |
| 36 #include "build/build_config.h" | 36 #include "build/build_config.h" |
| 37 #include "content/common/child_process_sandbox_support_impl_linux.h" | 37 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 38 #include "content/common/font_config_ipc_linux.h" | 38 #include "content/common/font_config_ipc_linux.h" |
| 39 #include "content/common/media/cdm_host_files.h" |
| 39 #include "content/common/sandbox_linux/sandbox_debug_handling_linux.h" | 40 #include "content/common/sandbox_linux/sandbox_debug_handling_linux.h" |
| 40 #include "content/common/sandbox_linux/sandbox_linux.h" | 41 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 41 #include "content/common/zygote_commands_linux.h" | 42 #include "content/common/zygote_commands_linux.h" |
| 42 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 43 #include "content/public/common/main_function_params.h" | 44 #include "content/public/common/main_function_params.h" |
| 44 #include "content/public/common/sandbox_linux.h" | 45 #include "content/public/common/sandbox_linux.h" |
| 45 #include "content/public/common/zygote_fork_delegate_linux.h" | 46 #include "content/public/common/zygote_fork_delegate_linux.h" |
| 46 #include "content/zygote/zygote_linux.h" | 47 #include "content/zygote/zygote_linux.h" |
| 47 #include "media/media_features.h" | 48 #include "media/media_features.h" |
| 48 #include "ppapi/features/features.h" | 49 #include "ppapi/features/features.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 RAND_set_urandom_fd(base::GetUrandomFD()); | 361 RAND_set_urandom_fd(base::GetUrandomFD()); |
| 361 | 362 |
| 362 #if BUILDFLAG(ENABLE_PLUGINS) | 363 #if BUILDFLAG(ENABLE_PLUGINS) |
| 363 // Ensure access to the Pepper plugins before the sandbox is turned on. | 364 // Ensure access to the Pepper plugins before the sandbox is turned on. |
| 364 PreloadPepperPlugins(); | 365 PreloadPepperPlugins(); |
| 365 #endif | 366 #endif |
| 366 #if BUILDFLAG(ENABLE_WEBRTC) | 367 #if BUILDFLAG(ENABLE_WEBRTC) |
| 367 InitializeWebRtcModule(); | 368 InitializeWebRtcModule(); |
| 368 #endif | 369 #endif |
| 369 | 370 |
| 371 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 372 CdmHostFiles::CreateGlobalInstance(); |
| 373 #endif |
| 374 |
| 370 SkFontConfigInterface::SetGlobal( | 375 SkFontConfigInterface::SetGlobal( |
| 371 new FontConfigIPC(GetSandboxFD()))->unref(); | 376 new FontConfigIPC(GetSandboxFD()))->unref(); |
| 372 | 377 |
| 373 // Set the android SkFontMgr for blink. We need to ensure this is done | 378 // Set the android SkFontMgr for blink. We need to ensure this is done |
| 374 // before the sandbox is initialized to allow the font manager to access | 379 // before the sandbox is initialized to allow the font manager to access |
| 375 // font configuration files on disk. | 380 // font configuration files on disk. |
| 376 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 381 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 377 switches::kAndroidFontsPath)) { | 382 switches::kAndroidFontsPath)) { |
| 378 std::string android_fonts_dir = | 383 std::string android_fonts_dir = |
| 379 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 384 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; | 670 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; |
| 666 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); | 671 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); |
| 667 | 672 |
| 668 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, | 673 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, |
| 669 extra_fds); | 674 extra_fds); |
| 670 // This function call can return multiple times, once per fork(). | 675 // This function call can return multiple times, once per fork(). |
| 671 return zygote.ProcessRequests(); | 676 return zygote.ProcessRequests(); |
| 672 } | 677 } |
| 673 | 678 |
| 674 } // namespace content | 679 } // namespace content |
| OLD | NEW |