Remove crashed render processes from metrics
This commit is contained in:
parent
b5879b7399
commit
d6e626c7e3
4 changed files with 37 additions and 9 deletions
|
@ -687,17 +687,25 @@ void App::BrowserChildProcessHostDisconnected(
|
|||
ChildProcessDisconnected(base::GetProcId(data.handle));
|
||||
}
|
||||
|
||||
void App::BrowserChildProcessCrashed(const content::ChildProcessData& data,
|
||||
int exit_code) {
|
||||
ChildProcessDisconnected(base::GetProcId(data.handle));
|
||||
}
|
||||
|
||||
void App::BrowserChildProcessKilled(const content::ChildProcessData& data,
|
||||
int exit_code) {
|
||||
ChildProcessDisconnected(base::GetProcId(data.handle));
|
||||
}
|
||||
|
||||
void App::RenderProcessReady(content::RenderProcessHost* host) {
|
||||
ChildProcessLaunched(content::PROCESS_TYPE_RENDERER, host->GetHandle());
|
||||
}
|
||||
|
||||
void App::RenderProcessDisconnected(content::RenderProcessHost* host) {
|
||||
ChildProcessDisconnected(base::GetProcId(host->GetHandle()));
|
||||
void App::RenderProcessDisconnected(base::ProcessId host_pid) {
|
||||
ChildProcessDisconnected(host_pid);
|
||||
}
|
||||
|
||||
void App::ChildProcessLaunched(
|
||||
int process_type,
|
||||
base::ProcessHandle handle) {
|
||||
void App::ChildProcessLaunched(int process_type, base::ProcessHandle handle) {
|
||||
auto pid = base::GetProcId(handle);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ATOM_BROWSER_API_ATOM_API_APP_H_
|
||||
#define ATOM_BROWSER_API_ATOM_API_APP_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -92,7 +93,7 @@ class App : public AtomBrowserClient::Delegate,
|
|||
|
||||
base::FilePath GetAppPath() const;
|
||||
void RenderProcessReady(content::RenderProcessHost* host);
|
||||
void RenderProcessDisconnected(content::RenderProcessHost* host);
|
||||
void RenderProcessDisconnected(base::ProcessId host_pid);
|
||||
|
||||
protected:
|
||||
explicit App(v8::Isolate* isolate);
|
||||
|
@ -143,6 +144,10 @@ class App : public AtomBrowserClient::Delegate,
|
|||
const content::ChildProcessData& data) override;
|
||||
void BrowserChildProcessHostDisconnected(
|
||||
const content::ChildProcessData& data) override;
|
||||
void BrowserChildProcessCrashed(
|
||||
const content::ChildProcessData& data, int exit_code) override;
|
||||
void BrowserChildProcessKilled(
|
||||
const content::ChildProcessData& data, int exit_code) override;
|
||||
|
||||
private:
|
||||
void SetAppPath(const base::FilePath& app_path);
|
||||
|
|
|
@ -408,15 +408,26 @@ void AtomBrowserClient::RenderProcessHostDestroyed(
|
|||
}
|
||||
}
|
||||
RemoveProcessPreferences(process_id);
|
||||
if (delegate_) {
|
||||
static_cast<api::App*>(delegate_)->RenderProcessDisconnected(host);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomBrowserClient::RenderProcessReady(content::RenderProcessHost* host) {
|
||||
render_process_host_pids_[host->GetID()] = base::GetProcId(host->GetHandle());
|
||||
if (delegate_) {
|
||||
static_cast<api::App*>(delegate_)->RenderProcessReady(host);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomBrowserClient::RenderProcessExited(content::RenderProcessHost* host,
|
||||
base::TerminationStatus status,
|
||||
int exit_code) {
|
||||
auto host_pid = render_process_host_pids_.find(host->GetID());
|
||||
if (host_pid != render_process_host_pids_.end()) {
|
||||
if (delegate_) {
|
||||
static_cast<api::App*>(delegate_)->RenderProcessDisconnected(
|
||||
host_pid->second);
|
||||
}
|
||||
render_process_host_pids_.erase(host_pid);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -110,6 +110,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
|||
// content::RenderProcessHostObserver:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
void RenderProcessReady(content::RenderProcessHost* host) override;
|
||||
void RenderProcessExited(content::RenderProcessHost* host,
|
||||
base::TerminationStatus status,
|
||||
int exit_code) override;
|
||||
|
||||
private:
|
||||
bool ShouldCreateNewSiteInstance(content::RenderFrameHost* render_frame_host,
|
||||
|
@ -129,6 +132,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
|||
std::map<int, int> pending_processes_;
|
||||
|
||||
std::map<int, ProcessPreferences> process_preferences_;
|
||||
std::map<int, base::ProcessId> render_process_host_pids_;
|
||||
base::Lock process_preferences_lock_;
|
||||
|
||||
std::unique_ptr<AtomResourceDispatcherHostDelegate>
|
||||
|
|
Loading…
Reference in a new issue