Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support ELECTRON_DEFAULT_ERROR_MODE in the GPU process
- Loading branch information
Showing
7 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2019 GitHub, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "atom/browser/atom_gpu_client.h" | ||
|
||
#include "base/environment.h" | ||
|
||
#if defined(OS_WIN) | ||
#include <windows.h> | ||
#endif | ||
|
||
namespace atom { | ||
|
||
AtomGpuClient::AtomGpuClient() = default; | ||
|
||
void AtomGpuClient::PreCreateMainMessageLoop() { | ||
#if defined(OS_WIN) | ||
auto env = base::Environment::Create(); | ||
if (env->HasVar("ELECTRON_DEFAULT_ERROR_MODE")) | ||
SetErrorMode(GetErrorMode() & ~SEM_NOGPFAULTERRORBOX); | ||
#endif | ||
} | ||
|
||
} // namespace atom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2019 GitHub, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ATOM_BROWSER_ATOM_GPU_CLIENT_H_ | ||
#define ATOM_BROWSER_ATOM_GPU_CLIENT_H_ | ||
|
||
#include "content/public/gpu/content_gpu_client.h" | ||
|
||
namespace atom { | ||
|
||
class AtomGpuClient : public content::ContentGpuClient { | ||
public: | ||
AtomGpuClient(); | ||
|
||
// content::ContentGpuClient: | ||
void PreCreateMainMessageLoop() override; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(AtomGpuClient); | ||
}; | ||
|
||
} // namespace atom | ||
|
||
#endif // ATOM_BROWSER_ATOM_GPU_CLIENT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
patches/common/chromium/add_contentgpuclient_precreatemainmessageloop_callback.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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::PreCreateMainMessageLoop() callback | ||
|
||
|
||
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc | ||
index 39e87967360a9c7a2856ce4df9c182c782efb2a5..cb82d66212430a01605231ffe4596fc7d794577a 100644 | ||
--- a/content/gpu/gpu_main.cc | ||
+++ b/content/gpu/gpu_main.cc | ||
@@ -234,6 +234,10 @@ int GpuMain(const MainFunctionParams& parameters) { | ||
|
||
logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | ||
|
||
+ auto* client = GetContentClient()->gpu(); | ||
+ if (client) | ||
+ client->PreCreateMainMessageLoop(); | ||
+ | ||
// We are experiencing what appear to be memory-stomp issues in the GPU | ||
// process. These issues seem to be impacting the message loop and listeners | ||
// registered to it. Create the message loop on the heap to guard against | ||
@@ -329,7 +333,6 @@ int GpuMain(const MainFunctionParams& parameters) { | ||
|
||
GpuProcess gpu_process(io_thread_priority); | ||
|
||
- 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 20e31e1bd96395cb4350aa6ae84cc16c4ca2116b..abf347a94e47ca2d9383eaaa526c313c42ac146e 100644 | ||
--- a/content/public/gpu/content_gpu_client.h | ||
+++ b/content/public/gpu/content_gpu_client.h | ||
@@ -35,6 +35,10 @@ class CONTENT_EXPORT ContentGpuClient { | ||
public: | ||
virtual ~ContentGpuClient() {} | ||
|
||
+ // Allows the embedder to perform platform-specific initializatioion before | ||
+ // creating the main message loop. | ||
+ virtual void PreCreateMainMessageLoop() {} | ||
+ | ||
// Initializes the registry. |registry| will be passed to a ConnectionFilter | ||
// (which lives on the IO thread). Unlike other childthreads, the client must | ||
// register additional interfaces on this registry rather than just creating |