Browse Source

chore: remove deprecated `gpu-process-crashed` event (#40255)

Co-authored-by: John Kleinschmidt <[email protected]>
Milan Burda 1 year ago
parent
commit
30fbcfca7b

+ 0 - 14
docs/api/app.md

@@ -377,20 +377,6 @@ page.
 
 Emitted whenever there is a GPU info update.
 
-### Event: 'gpu-process-crashed' _Deprecated_
-
-Returns:
-
-* `event` Event
-* `killed` boolean
-
-Emitted when the GPU process crashes or is killed.
-
-**Deprecated:** This event is superceded by the `child-process-gone` event
-which contains more information about why the child process disappeared. It
-isn't always because it crashed. The `killed` boolean can be replaced by
-checking `reason === 'killed'` when you switch to that event.
-
 ### Event: 'render-process-gone'
 
 Returns:

+ 13 - 0
docs/breaking-changes.md

@@ -42,6 +42,19 @@ win.webContents.on('render-process-gone', (event, details) => { /* ... */ })
 webview.addEventListener('render-process-gone', (event) => { /* ... */ })
 ```
 
+### Removed: `gpu-process-crashed` event on `app`
+
+The `gpu-process-crashed` event on `app` has been removed.
+Use the new `child-process-gone` event instead.
+
+```js
+// Removed
+app.on('gpu-process-crashed', (event, killed) => { /* ... */ })
+
+// Replace with
+app.on('child-process-gone', (event, details) => { /* ... */ })
+```
+
 ## Planned Breaking API Changes (28.0)
 
 ### Behavior Changed: `WebContents.backgroundThrottling` set to false affects all `WebContents` in the host `BrowserWindow`

+ 0 - 7
lib/browser/api/app.ts

@@ -1,7 +1,6 @@
 import * as fs from 'fs';
 
 import { Menu } from 'electron/main';
-import * as deprecate from '@electron/internal/common/deprecate';
 
 const bindings = process._linkedBinding('electron_browser_app');
 const commandLine = process._linkedBinding('electron_common_command_line');
@@ -112,9 +111,3 @@ for (const name of events) {
     webContents.emit(name, event, ...args);
   });
 }
-
-// Deprecation.
-deprecate.event(app, 'gpu-process-crashed', 'child-process-gone', () => {
-  // the old event is still emitted by App::OnGpuProcessCrashed()
-  return undefined;
-});

+ 0 - 4
shell/browser/api/electron_api_app.cc

@@ -842,10 +842,6 @@ void App::OnGpuInfoUpdate() {
   Emit("gpu-info-update");
 }
 
-void App::OnGpuProcessCrashed() {
-  Emit("gpu-process-crashed", true);
-}
-
 void App::BrowserChildProcessLaunchedAndConnected(
     const content::ChildProcessData& data) {
   ChildProcessLaunched(data.process_type, data.id, data.GetProcess().Handle(),

+ 0 - 1
shell/browser/api/electron_api_app.h

@@ -153,7 +153,6 @@ class App : public ElectronBrowserClient::Delegate,
 
   // content::GpuDataManagerObserver:
   void OnGpuInfoUpdate() override;
-  void OnGpuProcessCrashed() override;
 
   // content::BrowserChildProcessObserver:
   void BrowserChildProcessLaunchedAndConnected(

+ 3 - 0
spec/ts-smoke/electron/main.ts

@@ -441,6 +441,9 @@ app.configureHostResolver({ secureDnsMode: 'foo' });
 // @ts-expect-error Removed API
 console.log(app.runningUnderRosettaTranslation);
 
+// @ts-expect-error Removed API
+app.on('gpu-process-crashed', () => {});
+
 // @ts-expect-error Removed API
 app.on('renderer-process-crashed', () => {});