refactor: simplify child process tracking for app.getAppMetrics() (#26657)

This commit is contained in:
Milan Burda 2020-12-01 02:47:46 +01:00 committed by GitHub
parent 61f339d3aa
commit 4e3e3d414d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 27 deletions

View file

@ -1125,8 +1125,6 @@ void ElectronBrowserClient::RenderProcessHostDestroyed(
void ElectronBrowserClient::RenderProcessReady(
content::RenderProcessHost* host) {
render_process_host_pids_[host->GetID()] =
base::GetProcId(host->GetProcess().Handle());
if (delegate_) {
static_cast<api::App*>(delegate_)->RenderProcessReady(host);
}
@ -1135,13 +1133,8 @@ void ElectronBrowserClient::RenderProcessReady(
void ElectronBrowserClient::RenderProcessExited(
content::RenderProcessHost* host,
const content::ChildProcessTerminationInfo& info) {
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);
if (delegate_) {
static_cast<api::App*>(delegate_)->RenderProcessExited(host);
}
}