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)); |   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) { | void App::RenderProcessReady(content::RenderProcessHost* host) { | ||||||
|   ChildProcessLaunched(content::PROCESS_TYPE_RENDERER, host->GetHandle()); |   ChildProcessLaunched(content::PROCESS_TYPE_RENDERER, host->GetHandle()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void App::RenderProcessDisconnected(content::RenderProcessHost* host) { | void App::RenderProcessDisconnected(base::ProcessId host_pid) { | ||||||
|   ChildProcessDisconnected(base::GetProcId(host->GetHandle())); |   ChildProcessDisconnected(host_pid); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void App::ChildProcessLaunched( | void App::ChildProcessLaunched(int process_type, base::ProcessHandle handle) { | ||||||
|     int process_type, |  | ||||||
|     base::ProcessHandle handle) { |  | ||||||
|   auto pid = base::GetProcId(handle); |   auto pid = base::GetProcId(handle); | ||||||
| 
 | 
 | ||||||
| #if defined(OS_MACOSX) | #if defined(OS_MACOSX) | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ | ||||||
| #ifndef ATOM_BROWSER_API_ATOM_API_APP_H_ | #ifndef ATOM_BROWSER_API_ATOM_API_APP_H_ | ||||||
| #define ATOM_BROWSER_API_ATOM_API_APP_H_ | #define ATOM_BROWSER_API_ATOM_API_APP_H_ | ||||||
| 
 | 
 | ||||||
|  | #include <memory> | ||||||
| #include <string> | #include <string> | ||||||
| #include <utility> | #include <utility> | ||||||
| #include <vector> | #include <vector> | ||||||
|  | @ -92,7 +93,7 @@ class App : public AtomBrowserClient::Delegate, | ||||||
| 
 | 
 | ||||||
|   base::FilePath GetAppPath() const; |   base::FilePath GetAppPath() const; | ||||||
|   void RenderProcessReady(content::RenderProcessHost* host); |   void RenderProcessReady(content::RenderProcessHost* host); | ||||||
|   void RenderProcessDisconnected(content::RenderProcessHost* host); |   void RenderProcessDisconnected(base::ProcessId host_pid); | ||||||
| 
 | 
 | ||||||
|  protected: |  protected: | ||||||
|   explicit App(v8::Isolate* isolate); |   explicit App(v8::Isolate* isolate); | ||||||
|  | @ -143,6 +144,10 @@ class App : public AtomBrowserClient::Delegate, | ||||||
|       const content::ChildProcessData& data) override; |       const content::ChildProcessData& data) override; | ||||||
|   void BrowserChildProcessHostDisconnected( |   void BrowserChildProcessHostDisconnected( | ||||||
|       const content::ChildProcessData& data) override; |       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: |  private: | ||||||
|   void SetAppPath(const base::FilePath& app_path); |   void SetAppPath(const base::FilePath& app_path); | ||||||
|  |  | ||||||
|  | @ -408,15 +408,26 @@ void AtomBrowserClient::RenderProcessHostDestroyed( | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   RemoveProcessPreferences(process_id); |   RemoveProcessPreferences(process_id); | ||||||
|   if (delegate_) { |  | ||||||
|     static_cast<api::App*>(delegate_)->RenderProcessDisconnected(host); |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AtomBrowserClient::RenderProcessReady(content::RenderProcessHost* host) { | void AtomBrowserClient::RenderProcessReady(content::RenderProcessHost* host) { | ||||||
|  |   render_process_host_pids_[host->GetID()] = base::GetProcId(host->GetHandle()); | ||||||
|   if (delegate_) { |   if (delegate_) { | ||||||
|     static_cast<api::App*>(delegate_)->RenderProcessReady(host); |     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
 | }  // namespace atom
 | ||||||
|  |  | ||||||
|  | @ -110,6 +110,9 @@ class AtomBrowserClient : public brightray::BrowserClient, | ||||||
|   // content::RenderProcessHostObserver:
 |   // content::RenderProcessHostObserver:
 | ||||||
|   void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; |   void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; | ||||||
|   void RenderProcessReady(content::RenderProcessHost* host) override; |   void RenderProcessReady(content::RenderProcessHost* host) override; | ||||||
|  |   void RenderProcessExited(content::RenderProcessHost* host, | ||||||
|  |                            base::TerminationStatus status, | ||||||
|  |                            int exit_code) override; | ||||||
| 
 | 
 | ||||||
|  private: |  private: | ||||||
|   bool ShouldCreateNewSiteInstance(content::RenderFrameHost* render_frame_host, |   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, int> pending_processes_; | ||||||
| 
 | 
 | ||||||
|   std::map<int, ProcessPreferences> process_preferences_; |   std::map<int, ProcessPreferences> process_preferences_; | ||||||
|  |   std::map<int, base::ProcessId> render_process_host_pids_; | ||||||
|   base::Lock process_preferences_lock_; |   base::Lock process_preferences_lock_; | ||||||
| 
 | 
 | ||||||
|   std::unique_ptr<AtomResourceDispatcherHostDelegate> |   std::unique_ptr<AtomResourceDispatcherHostDelegate> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kevin Sawicki
				Kevin Sawicki