From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Milan Burda <milan.burda@gmail.com>
Date: Thu, 11 Apr 2019 14:49:20 +0200
Subject: add_contentgpuclient_precreatemessageloop_callback.patch
This adds a ContentGpuClient::PreCreateMessageLoop() callback.
Invoke in GpuMain after SetErrorMode, before starting the message loop.
Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
This should be upstreamed.
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index d7cab7265bc75d4df0d570cab10508327fc82afe..95deade7499c9c7e3762cfa9cceba0d13d2f62ae 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -256,6 +256,10 @@ int GpuMain(const MainFunctionParams& parameters) {
// to the GpuProcessHost once the GpuServiceImpl has started.
viz::GpuServiceImpl::InstallPreInitializeLogHandler();
+ auto* client = GetContentClient()->gpu();
+ if (client)
+ client->PreCreateMessageLoop();
+
// We are experiencing what appear to be memory-stomp issues in the GPU
// process. These issues seem to be impacting the task executor and listeners
// registered to it. Create the task executor on the heap to guard against
@@ -393,7 +397,6 @@ int GpuMain(const MainFunctionParams& parameters) {
}
#endif
- auto* client = GetContentClient()->gpu();
if (client)
client->PostIOThreadCreated(gpu_process.io_task_runner());
diff --git a/content/public/gpu/content_gpu_client.h b/content/public/gpu/content_gpu_client.h
index 2231ce937692f567fd2d4661e4feea389e12203e..a281c7bd40dac0acf350d08683e7c71282a83e9a 100644
--- a/content/public/gpu/content_gpu_client.h
+++ b/content/public/gpu/content_gpu_client.h
@@ -31,6 +31,10 @@ class CONTENT_EXPORT ContentGpuClient {
public:
virtual ~ContentGpuClient() {}
+ // Allows the embedder to perform platform-specific initialization before
+ // creating the message loop.
+ virtual void PreCreateMessageLoop() {}
// Called during initialization once the GpuService has been initialized.
virtual void GpuServiceInitialized() {}