| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 #if BUILDFLAG(ENABLE_WEBRTC) | 70 #if BUILDFLAG(ENABLE_WEBRTC) |
| 71 #include "third_party/webrtc_overrides/init_webrtc.h" | 71 #include "third_party/webrtc_overrides/init_webrtc.h" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 #if defined(SANITIZER_COVERAGE) | 74 #if defined(SANITIZER_COVERAGE) |
| 75 #include <sanitizer/common_interface_defs.h> | 75 #include <sanitizer/common_interface_defs.h> |
| 76 #include <sanitizer/coverage_interface.h> | 76 #include <sanitizer/coverage_interface.h> |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 80 #include "content/common/media/cdm_host_files.h" |
| 81 #endif |
| 82 |
| 79 namespace content { | 83 namespace content { |
| 80 | 84 |
| 81 namespace { | 85 namespace { |
| 82 | 86 |
| 83 base::LazyInstance<std::set<std::string>>::Leaky g_timezones = | 87 base::LazyInstance<std::set<std::string>>::Leaky g_timezones = |
| 84 LAZY_INSTANCE_INITIALIZER; | 88 LAZY_INSTANCE_INITIALIZER; |
| 85 base::LazyInstance<base::Lock>::Leaky g_timezones_lock = | 89 base::LazyInstance<base::Lock>::Leaky g_timezones_lock = |
| 86 LAZY_INSTANCE_INITIALIZER; | 90 LAZY_INSTANCE_INITIALIZER; |
| 87 | 91 |
| 88 void CloseFds(const std::vector<int>& fds) { | 92 void CloseFds(const std::vector<int>& fds) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 RAND_set_urandom_fd(base::GetUrandomFD()); | 364 RAND_set_urandom_fd(base::GetUrandomFD()); |
| 361 | 365 |
| 362 #if BUILDFLAG(ENABLE_PLUGINS) | 366 #if BUILDFLAG(ENABLE_PLUGINS) |
| 363 // Ensure access to the Pepper plugins before the sandbox is turned on. | 367 // Ensure access to the Pepper plugins before the sandbox is turned on. |
| 364 PreloadPepperPlugins(); | 368 PreloadPepperPlugins(); |
| 365 #endif | 369 #endif |
| 366 #if BUILDFLAG(ENABLE_WEBRTC) | 370 #if BUILDFLAG(ENABLE_WEBRTC) |
| 367 InitializeWebRtcModule(); | 371 InitializeWebRtcModule(); |
| 368 #endif | 372 #endif |
| 369 | 373 |
| 374 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 375 CdmHostFiles::CreateGlobalInstance(); |
| 376 #endif |
| 377 |
| 370 SkFontConfigInterface::SetGlobal( | 378 SkFontConfigInterface::SetGlobal( |
| 371 new FontConfigIPC(GetSandboxFD()))->unref(); | 379 new FontConfigIPC(GetSandboxFD()))->unref(); |
| 372 | 380 |
| 373 // Set the android SkFontMgr for blink. We need to ensure this is done | 381 // 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 | 382 // before the sandbox is initialized to allow the font manager to access |
| 375 // font configuration files on disk. | 383 // font configuration files on disk. |
| 376 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 384 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 377 switches::kAndroidFontsPath)) { | 385 switches::kAndroidFontsPath)) { |
| 378 std::string android_fonts_dir = | 386 std::string android_fonts_dir = |
| 379 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 387 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; | 673 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; |
| 666 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); | 674 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); |
| 667 | 675 |
| 668 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, | 676 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, |
| 669 extra_fds); | 677 extra_fds); |
| 670 // This function call can return multiple times, once per fork(). | 678 // This function call can return multiple times, once per fork(). |
| 671 return zygote.ProcessRequests(); | 679 return zygote.ProcessRequests(); |
| 672 } | 680 } |
| 673 | 681 |
| 674 } // namespace content | 682 } // namespace content |
| OLD | NEW |