mac: Force InitializeVideoToolbox() in the GPU's PreSandboxStartup().
Under the V2 sandbox architecture, there is technically nothing that
runs "pre-sandbox startup". But we hypothesize that deferring the
initialization of VideoToolbox to the first use is leading to hangs,
which the watchdog turns into crashes. By forcing initialization at this
call site, the GPU watchdog thread is not running, which is what happens
under the V1 sandbox architecture.
Bug: 871280
Change-Id: I7c1173ecf7752307c19ac15f81e9b1c699d4523b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1932166
Reviewed-by: Greg Kerr <[email protected]>
Reviewed-by: Zhenyao Mo <[email protected]>
Commit-Queue: Robert Sesek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#719164}
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 71ca9ce..1bc78267 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -92,6 +92,8 @@
#if defined(OS_MACOSX)
#include "base/message_loop/message_pump_mac.h"
#include "components/metal_util/test_shader.h"
+#include "content/public/common/content_features.h"
+#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
#include "sandbox/mac/seatbelt.h"
#include "services/service_manager/sandbox/mac/sandbox_mac.h"
#endif
@@ -157,6 +159,13 @@
media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization();
#endif
+#if defined(OS_MACOSX)
+ if (base::FeatureList::IsEnabled(features::kMacV2GPUSandbox)) {
+ TRACE_EVENT0("gpu", "Initialize VideoToolbox");
+ media::InitializeVideoToolbox();
+ }
+#endif
+
// On Linux, reading system memory doesn't work through the GPU sandbox.
// This value is cached, so access it here to populate the cache.
base::SysInfo::AmountOfPhysicalMemory();