Move gpu-crashed event to app
This commit is contained in:
parent
09c2317ae6
commit
ffd9c743de
4 changed files with 14 additions and 12 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "brightray/browser/brightray_paths.h"
|
#include "brightray/browser/brightray_paths.h"
|
||||||
#include "content/public/browser/client_certificate_delegate.h"
|
#include "content/public/browser/client_certificate_delegate.h"
|
||||||
|
#include "content/public/browser/gpu_data_manager.h"
|
||||||
#include "native_mate/callback.h"
|
#include "native_mate/callback.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
|
@ -135,10 +136,12 @@ void OnClientCertificateSelected(
|
||||||
|
|
||||||
App::App() {
|
App::App() {
|
||||||
Browser::Get()->AddObserver(this);
|
Browser::Get()->AddObserver(this);
|
||||||
|
content::GpuDataManager::GetInstance()->AddObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
App::~App() {
|
App::~App() {
|
||||||
Browser::Get()->RemoveObserver(this);
|
Browser::Get()->RemoveObserver(this);
|
||||||
|
content::GpuDataManager::GetInstance()->RemoveObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::OnBeforeQuit(bool* prevent_default) {
|
void App::OnBeforeQuit(bool* prevent_default) {
|
||||||
|
@ -206,6 +209,10 @@ void App::OnSelectCertificate(
|
||||||
cert_request_info->client_certs[0].get());
|
cert_request_info->client_certs[0].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
|
||||||
|
Emit("gpu-crashed");
|
||||||
|
}
|
||||||
|
|
||||||
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
|
base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
|
||||||
bool succeed = false;
|
bool succeed = false;
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "atom/browser/api/event_emitter.h"
|
#include "atom/browser/api/event_emitter.h"
|
||||||
#include "atom/browser/browser_observer.h"
|
#include "atom/browser/browser_observer.h"
|
||||||
|
#include "content/public/browser/gpu_data_manager_observer.h"
|
||||||
#include "native_mate/handle.h"
|
#include "native_mate/handle.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
@ -24,7 +25,8 @@ namespace atom {
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
class App : public mate::EventEmitter,
|
class App : public mate::EventEmitter,
|
||||||
public BrowserObserver {
|
public BrowserObserver,
|
||||||
|
public content::GpuDataManagerObserver {
|
||||||
public:
|
public:
|
||||||
static mate::Handle<App> Create(v8::Isolate* isolate);
|
static mate::Handle<App> Create(v8::Isolate* isolate);
|
||||||
|
|
||||||
|
@ -47,6 +49,9 @@ class App : public mate::EventEmitter,
|
||||||
net::SSLCertRequestInfo* cert_request_info,
|
net::SSLCertRequestInfo* cert_request_info,
|
||||||
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
|
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
|
||||||
|
|
||||||
|
// content::GpuDataManagerObserver:
|
||||||
|
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
||||||
|
|
||||||
// mate::Wrappable:
|
// mate::Wrappable:
|
||||||
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||||
v8::Isolate* isolate) override;
|
v8::Isolate* isolate) override;
|
||||||
|
|
|
@ -328,11 +328,6 @@ void WebContents::PluginCrashed(const base::FilePath& plugin_path,
|
||||||
Emit("plugin-crashed", info.name, info.version);
|
Emit("plugin-crashed", info.name, info.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::OnGpuProcessCrashed(base::TerminationStatus exit_code) {
|
|
||||||
if (exit_code == base::TERMINATION_STATUS_PROCESS_CRASHED)
|
|
||||||
Emit("gpu-crashed");
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebContents::DocumentLoadedInFrame(
|
void WebContents::DocumentLoadedInFrame(
|
||||||
content::RenderFrameHost* render_frame_host) {
|
content::RenderFrameHost* render_frame_host) {
|
||||||
if (!render_frame_host->GetParent())
|
if (!render_frame_host->GetParent())
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "atom/browser/common_web_contents_delegate.h"
|
#include "atom/browser/common_web_contents_delegate.h"
|
||||||
#include "content/public/common/favicon_url.h"
|
#include "content/public/common/favicon_url.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "content/public/browser/gpu_data_manager_observer.h"
|
|
||||||
#include "native_mate/handle.h"
|
#include "native_mate/handle.h"
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
|
|
||||||
|
@ -34,8 +33,7 @@ namespace api {
|
||||||
|
|
||||||
class WebContents : public mate::TrackableObject<WebContents>,
|
class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
public CommonWebContentsDelegate,
|
public CommonWebContentsDelegate,
|
||||||
public content::WebContentsObserver,
|
public content::WebContentsObserver {
|
||||||
public content::GpuDataManagerObserver {
|
|
||||||
public:
|
public:
|
||||||
// For node.js callback function type: function(error, buffer)
|
// For node.js callback function type: function(error, buffer)
|
||||||
typedef base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>
|
typedef base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>
|
||||||
|
@ -185,9 +183,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void PluginCrashed(const base::FilePath& plugin_path,
|
void PluginCrashed(const base::FilePath& plugin_path,
|
||||||
base::ProcessId plugin_pid) override;
|
base::ProcessId plugin_pid) override;
|
||||||
|
|
||||||
// content::GpuDataManagerObserver:
|
|
||||||
void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Type {
|
enum Type {
|
||||||
BROWSER_WINDOW, // Used by BrowserWindow.
|
BROWSER_WINDOW, // Used by BrowserWindow.
|
||||||
|
|
Loading…
Reference in a new issue