Spawn GPU process from the unsandboxed zygote.
Now that we have an unsandboxed zygote from https://crrev.com/742875 we
can spawn all process types from it. This ensures we use the same binary
as the browser process even when the on disk version changes.
Bug: 22703
Test: All existing tests still pass.
Change-Id: I56ab870ca591d10723b19ccba2d5de4420d99249
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067393
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Kenneth Russell <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Commit-Queue: Kenneth Russell <[email protected]>
Auto-Submit: Dale Curtis <[email protected]>
Cr-Commit-Position: refs/heads/master@{#743371}
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 6c446a1..24f9e8e 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -48,6 +48,7 @@
#include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "media/gpu/buildflags.h"
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
+#include "services/tracing/public/cpp/trace_startup.h"
#include "third_party/angle/src/gpu_info_util/SystemInfo.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/switches.h"
@@ -397,6 +398,15 @@
gpu_process.set_main_thread(child_thread);
+#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
+ // Startup tracing is usually enabled earlier, but if we forked from a zygote,
+ // we can only enable it after mojo IPC support is brought up initialized by
+ // GpuChildThread, because the mojo broker has to create the tracing SMB on
+ // our behalf due to the zygote sandbox.
+ if (parameters.zygote_child)
+ tracing::EnableStartupTracingIfNeeded();
+#endif // OS_POSIX && !OS_ANDROID && !!OS_MACOSX
+
// Setup tracing sampler profiler as early as possible.
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler =
tracing::TracingSamplerProfiler::CreateOnMainThread();