diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 06:57:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 06:57:47 +0000 |
commit | 463ea5fc399e6275a2351df6b398b7d91b8f5a61 (patch) | |
tree | 051c35d716015f973bb9fa3d7f8a09a3c7e0c3f7 | |
parent | ac198a5076f95d83b40f8c5b5d4473e11db08dcf (diff) | |
download | chromium_src-463ea5fc399e6275a2351df6b398b7d91b8f5a61.zip chromium_src-463ea5fc399e6275a2351df6b398b7d91b8f5a61.tar.gz chromium_src-463ea5fc399e6275a2351df6b398b7d91b8f5a61.tar.bz2 |
Simplify BrowserChildProcessHost in preparation for refactoring it so that consumers embed it in their class instead of deriving from it. The GetChildTerminationStatus override in NaclProcessHost seemed unnecessary since that's what the default implementation does. NaClProcessHost::OnChildDied can be done in the destructor.
BUG=98716
Review URL: http://codereview.chromium.org/8771041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112877 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/nacl_host/nacl_process_host.cc | 13 | ||||
-rw-r--r-- | chrome/browser/nacl_host/nacl_process_host.h | 3 | ||||
-rw-r--r-- | content/browser/browser_child_process_host.cc | 4 | ||||
-rw-r--r-- | content/browser/browser_child_process_host.h | 10 | ||||
-rw-r--r-- | content/public/browser/notification_types.h | 7 |
5 files changed, 13 insertions, 24 deletions
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 46a030c..f9ac0f5 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -149,6 +149,10 @@ NaClProcessHost::~NaClProcessHost() { reply_msg_->set_reply_error(); chrome_render_message_filter_->Send(reply_msg_); } + +#if defined(OS_WIN) + NaClBrokerService::GetInstance()->OnLoaderDied(); +#endif } // Attempt to ensure the IRT will be available when we need it, but don't wait. @@ -293,11 +297,10 @@ void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) { OnProcessLaunched(); } -base::TerminationStatus NaClProcessHost::GetChildTerminationStatus( - int* exit_code) { - if (RunningOnWOW64()) - return base::GetTerminationStatus(handle(), exit_code); - return BrowserChildProcessHost::GetChildTerminationStatus(exit_code); +void NaClProcessHost::OnProcessCrashed(int exit_code) { + std::string message = base::StringPrintf( + "NaCl process exited with status %i (0x%x)", exit_code, exit_code); + LOG(ERROR) << message; } // This only ever runs on the BrowserThread::FILE thread. diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index c2d8d8f..265e34f 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -41,8 +41,7 @@ class NaClProcessHost : public BrowserChildProcessHost { void OnProcessLaunchedByBroker(base::ProcessHandle handle); protected: - virtual base::TerminationStatus GetChildTerminationStatus( - int* exit_code) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) OVERRIDE; private: // Internal class that holds the nacl::Handle objecs so that diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc index 3e56b6e..7744153 100644 --- a/content/browser/browser_child_process_host.cc +++ b/content/browser/browser_child_process_host.cc @@ -131,6 +131,8 @@ void BrowserChildProcessHost::Notify(int type) { base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus( int* exit_code) { + if (!child_process_.get()) // If the delegate doesn't use Launch() helper. + return base::GetTerminationStatus(handle(), exit_code); return child_process_->GetChildTerminationStatus(exit_code); } @@ -174,9 +176,7 @@ void BrowserChildProcessHost::OnChildDisconnected() { break; } case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { - OnProcessWasKilled(exit_code); // Report that this child process was killed. - Notify(content::NOTIFICATION_CHILD_PROCESS_WAS_KILLED); UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed", this->type(), content::PROCESS_TYPE_MAX); diff --git a/content/browser/browser_child_process_host.h b/content/browser/browser_child_process_host.h index 97edf84..2abb0bf 100644 --- a/content/browser/browser_child_process_host.h +++ b/content/browser/browser_child_process_host.h @@ -99,19 +99,13 @@ class CONTENT_EXPORT BrowserChildProcessHost : // GetExitCodeProcess()). virtual void OnProcessCrashed(int exit_code) {} - // Derived classes can override this to know if the process was - // killed. |exit_code| is the status returned when the process - // was killed (for posix, as returned from waitpid(), for Windows, - // as returned from GetExitCodeProcess()). - virtual void OnProcessWasKilled(int exit_code) {} - // Returns the termination status of a child. |exit_code| is the // status returned when the process exited (for posix, as returned // from waitpid(), for Windows, as returned from // GetExitCodeProcess()). |exit_code| may be NULL. - virtual base::TerminationStatus GetChildTerminationStatus(int* exit_code); + base::TerminationStatus GetChildTerminationStatus(int* exit_code); - // ChildProcessHostDelegate implementation: + // Overrides from ChildProcessHost virtual bool CanShutdown() OVERRIDE; virtual void OnChildDisconnected() OVERRIDE; virtual void ShutdownStarted() OVERRIDE; diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h index aa29994..970a50e 100644 --- a/content/public/browser/notification_types.h +++ b/content/public/browser/notification_types.h @@ -391,13 +391,6 @@ enum NotificationType { // a Details<content::ChildProcessData>. NOTIFICATION_CHILD_PROCESS_CRASHED, - // This message is sent when a child process disappears - // unexpectedly as a result of a termination signal. There is no - // usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The - // details are in a Details<content::ChildProcessData>. - NOTIFICATION_CHILD_PROCESS_WAS_KILLED, - // This message indicates that an instance of a particular child was // created in a page. (If one page contains several regions rendered by // the same child, this notification will occur once for each region |