#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
Emit("crashed");
}
+void WebContents::PluginCrashed(const base::FilePath& plugin_path,
+ base::ProcessId plugin_pid) {
+ content::WebPluginInfo info;
+ auto plugin_service = content::PluginService::GetInstance();
+ plugin_service->GetPluginInfoByPath(plugin_path, &info);
+ 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(
content::RenderFrameHost* render_frame_host) {
if (!render_frame_host->GetParent())
#include "content/public/common/favicon_url.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/gpu_data_manager_observer.h"
#include "native_mate/handle.h"
#include "ui/gfx/image/image.h"
class WebContents : public mate::EventEmitter,
public content::BrowserPluginGuestDelegate,
public content::WebContentsDelegate,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public content::GpuDataManagerObserver {
public:
// Create from an existing WebContents.
static mate::Handle<WebContents> CreateFrom(
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
void DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& urls) override;
+ void PluginCrashed(const base::FilePath& plugin_path,
+ base::ProcessId plugin_pid) override;
// content::BrowserPluginGuestDelegate:
void DidAttach(int guest_proxy_routing_id) final;
int element_instance_id,
bool is_full_page_plugin) final;
+ // content::GpuDataManagerObserver:
+ void OnGpuProcessCrashed(base::TerminationStatus exit_code) override;
+
private:
// Called when received a message from renderer.
void OnRendererMessage(const base::string16& channel,
'new-window'
'close'
'crashed'
+ 'gpu-crashed'
+ 'plugin-crashed'
'destroyed'
'page-title-set'
'page-favicon-updated'
'new-window': ['url', 'frameName', 'disposition']
'close': []
'crashed': []
+ 'gpu-crashed': []
+ 'plugin-crashed': ['name', 'version']
'destroyed': []
'page-title-set': ['title', 'explicitSet']
'page-favicon-updated': ['favicons']
Emitted when the renderer process is crashed.
+### Event: 'gpu-crashed'
+
+Emitted when the gpu process is crashed.
+
+### Event: 'plugin-crashed'
+
+* `event` Event
+* `name` String
+* `version` String
+
+Emitted when a plugin process is crashed.
+
### Event: 'destroyed'
Emitted when the WebContents is destroyed.
Fired when the renderer process is crashed.
+### gpu-crashed
+
+Fired when the gpu process is crashed.
+
+### plugin-crashed
+
+* `name` String
+* `version` String
+
+Fired when a plugin process is crashed.
+
### destroyed
Fired when the WebContents is destroyed.