OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/browser_child_process_host.h" | 5 #include "chrome/browser/browser_child_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void BrowserChildProcessHost::ForceShutdown() { | 124 void BrowserChildProcessHost::ForceShutdown() { |
125 Singleton<ChildProcessList>::get()->remove(this); | 125 Singleton<ChildProcessList>::get()->remove(this); |
126 ChildProcessHost::ForceShutdown(); | 126 ChildProcessHost::ForceShutdown(); |
127 } | 127 } |
128 | 128 |
129 void BrowserChildProcessHost::Notify(NotificationType type) { | 129 void BrowserChildProcessHost::Notify(NotificationType type) { |
130 ChromeThread::PostTask( | 130 ChromeThread::PostTask( |
131 ChromeThread::UI, FROM_HERE, new ChildNotificationTask(type, this)); | 131 ChromeThread::UI, FROM_HERE, new ChildNotificationTask(type, this)); |
132 } | 132 } |
133 | 133 |
134 bool BrowserChildProcessHost::DidChildCrash() { | 134 base::TerminationStatus BrowserChildProcessHost::GetChildTerminationStatus( |
135 return child_process_->DidProcessCrash(); | 135 int* exit_code) { |
| 136 return child_process_->GetChildTerminationStatus(exit_code); |
136 } | 137 } |
137 | 138 |
138 void BrowserChildProcessHost::OnChildDied() { | 139 void BrowserChildProcessHost::OnChildDied() { |
139 if (handle() != base::kNullProcessHandle) { | 140 if (handle() != base::kNullProcessHandle) { |
140 bool did_crash = DidChildCrash(); | 141 int exit_code; |
141 if (did_crash) { | 142 base::TerminationStatus status = GetChildTerminationStatus(&exit_code); |
142 OnProcessCrashed(); | 143 switch (status) { |
143 // Report that this child process crashed. | 144 case base::TERMINATION_STATUS_PROCESS_CRASHED: { |
144 Notify(NotificationType::CHILD_PROCESS_CRASHED); | 145 OnProcessCrashed(exit_code); |
145 UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); | 146 |
| 147 // Report that this child process crashed. |
| 148 Notify(NotificationType::CHILD_PROCESS_CRASHED); |
| 149 UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type()); |
| 150 break; |
| 151 } |
| 152 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { |
| 153 OnProcessWasKilled(exit_code); |
| 154 |
| 155 // Report that this child process was killed. |
| 156 Notify(NotificationType::CHILD_PROCESS_WAS_KILLED); |
| 157 UMA_HISTOGRAM_COUNTS("ChildProcess.Kills", this->type()); |
| 158 break; |
| 159 } |
| 160 default: |
| 161 break; |
146 } | 162 } |
147 // Notify in the main loop of the disconnection. | 163 // Notify in the main loop of the disconnection. |
148 Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); | 164 Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); |
149 } | 165 } |
150 ChildProcessHost::OnChildDied(); | 166 ChildProcessHost::OnChildDied(); |
151 } | 167 } |
152 | 168 |
153 bool BrowserChildProcessHost::InterceptMessageFromChild( | 169 bool BrowserChildProcessHost::InterceptMessageFromChild( |
154 const IPC::Message& msg) { | 170 const IPC::Message& msg) { |
155 bool msg_is_ok = true; | 171 bool msg_is_ok = true; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 224 |
209 return *iterator_; | 225 return *iterator_; |
210 } while (true); | 226 } while (true); |
211 | 227 |
212 return NULL; | 228 return NULL; |
213 } | 229 } |
214 | 230 |
215 bool BrowserChildProcessHost::Iterator::Done() { | 231 bool BrowserChildProcessHost::Iterator::Done() { |
216 return iterator_ == Singleton<ChildProcessList>::get()->end(); | 232 return iterator_ == Singleton<ChildProcessList>::get()->end(); |
217 } | 233 } |
OLD | NEW |