From 8567f79e6791baebb9508ab50348e34edf70ceb3 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Sat, 17 Sep 2016 17:00:45 -0700 Subject: [PATCH] Add killed argument for webContents.on("crashed") and app.on("gpu-process-crashed") events --- atom/browser/api/atom_api_app.cc | 5 +++-- atom/browser/api/atom_api_app.h | 2 +- atom/browser/api/atom_api_web_contents.cc | 2 +- docs/api/app.md | 7 ++++++- docs/api/web-contents.md | 7 ++++++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 751293ee41a9..323a80cc8a25 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -585,8 +585,9 @@ void App::SelectClientCertificate( cert_request_info->client_certs[0].get()); } -void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) { - Emit("gpu-process-crashed"); +void App::OnGpuProcessCrashed(base::TerminationStatus status) { + Emit("gpu-process-crashed", + status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED); } base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) { diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 13641d04c266..c2afb15232ec 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -102,7 +102,7 @@ class App : public AtomBrowserClient::Delegate, std::unique_ptr delegate) override; // content::GpuDataManagerObserver: - void OnGpuProcessCrashed(base::TerminationStatus exit_code) override; + void OnGpuProcessCrashed(base::TerminationStatus status) override; private: // Get/Set the pre-defined path in PathService. diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index d9b47d055528..f7b8f1b7ba63 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -586,7 +586,7 @@ void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) { } void WebContents::RenderProcessGone(base::TerminationStatus status) { - Emit("crashed"); + Emit("crashed", status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED); } void WebContents::PluginCrashed(const base::FilePath& plugin_path, diff --git a/docs/api/app.md b/docs/api/app.md index 98450ee6f0fc..17194a39e83f 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -280,7 +280,12 @@ app.on('login', (event, webContents, request, authInfo, callback) => { ### Event: 'gpu-process-crashed' -Emitted when the gpu process crashes. +Returns: + +* `event` Event +* `killed` Boolean + +Emitted when the gpu process crashes or is killed. ### Event: 'accessibility-support-changed' _macOS_ _Windows_ diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 55cbfc63c33f..c2a1a3572402 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -203,7 +203,12 @@ are clicked or when the DOM `hashchange` event is triggered. #### Event: 'crashed' -Emitted when the renderer process has crashed. +Returns: + +* `event` Event +* `killed` Boolean + +Emitted when the renderer process crashes or is killed. #### Event: 'plugin-crashed'