Skip to content

Commit

Permalink
chore: remove deprecated gpu-process-crashed event (electron#40255)
Browse files Browse the repository at this point in the history
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
  • Loading branch information
miniak and jkleinsc authored Oct 26, 2023
1 parent 3f92a98 commit 30fbcfc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 26 deletions.
14 changes: 0 additions & 14 deletions docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions docs/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
7 changes: 0 additions & 7 deletions lib/browser/api/app.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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;
});
4 changes: 0 additions & 4 deletions shell/browser/api/electron_api_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion shell/browser/api/electron_api_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ class App : public ElectronBrowserClient::Delegate,

// content::GpuDataManagerObserver:
void OnGpuInfoUpdate() override;
void OnGpuProcessCrashed() override;

// content::BrowserChildProcessObserver:
void BrowserChildProcessLaunchedAndConnected(
Expand Down
3 changes: 3 additions & 0 deletions spec/ts-smoke/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {});

Expand Down

0 comments on commit 30fbcfc

Please sign in to comment.