diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/content/child/child_process.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/child/child_process.cc')
-rw-r--r-- | chromium/content/child/child_process.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chromium/content/child/child_process.cc b/chromium/content/child/child_process.cc index 04b8f40e3dc..0f4fa57ae42 100644 --- a/chromium/content/child/child_process.cc +++ b/chromium/content/child/child_process.cc @@ -16,6 +16,10 @@ #include "base/threading/thread_local.h" #include "build/build_config.h" #include "content/child/child_thread_impl.h" +#include "content/common/android/cpu_time_metrics.h" +#include "content/common/mojo_core_library_support.h" +#include "mojo/public/cpp/system/dynamic_library_support.h" +#include "services/service_manager/sandbox/sandbox_type.h" #include "services/tracing/public/cpp/trace_startup.h" #include "third_party/blink/public/common/features.h" @@ -37,6 +41,23 @@ ChildProcess::ChildProcess(base::ThreadPriority io_thread_priority, DCHECK(!g_lazy_child_process_tls.Pointer()->Get()); g_lazy_child_process_tls.Pointer()->Set(this); +#if defined(OS_LINUX) + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + if (IsMojoCoreSharedLibraryEnabled()) { + // If we're in a child process on Linux and dynamic Mojo Core is in use, we + // expect early process startup code (see ContentMainRunnerImpl::Run()) to + // have already loaded the library via |mojo::LoadCoreLibrary()|, rendering + // this call safe even from within a strict sandbox. + MojoInitializeFlags flags = MOJO_INITIALIZE_FLAG_NONE; + if (service_manager::IsUnsandboxedSandboxType( + service_manager::SandboxTypeFromCommandLine(command_line))) { + flags |= MOJO_INITIALIZE_FLAG_FORCE_DIRECT_SHARED_MEMORY_ALLOCATION; + } + CHECK_EQ(MOJO_RESULT_OK, mojo::InitializeCoreLibrary(flags)); + } +#endif + // Initialize ThreadPoolInstance if not already done. A ThreadPoolInstance may // already exist when ChildProcess is instantiated in the browser process or // in a test process. @@ -52,8 +73,13 @@ ChildProcess::ChildProcess(base::ThreadPriority io_thread_priority, DCHECK(base::ThreadPoolInstance::Get()); initialized_thread_pool_ = true; } + tracing::InitTracingPostThreadPoolStartAndFeatureList(); +#if defined(OS_ANDROID) + SetupCpuTimeMetrics(); +#endif + // We can't recover from failing to start the IO thread. base::Thread::Options thread_options(base::MessagePumpType::IO, 0); thread_options.priority = io_thread_priority; |