Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: content/browser/browser_child_process_host_impl.cc

Issue 9235052: Fix race condition in utility process clients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/browser_child_process_host_impl.h" 5 #include "content/browser/browser_child_process_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // delayed task to wait for an exit code. However, this means that this method 208 // delayed task to wait for an exit code. However, this means that this method
209 // may be called twice: once from the actual channel error and once from 209 // may be called twice: once from the actual channel error and once from
210 // OnWaitableEventSignaled() or the delayed task. 210 // OnWaitableEventSignaled() or the delayed task.
211 void BrowserChildProcessHostImpl::OnChildDisconnected() { 211 void BrowserChildProcessHostImpl::OnChildDisconnected() {
212 DCHECK(data_.handle != base::kNullProcessHandle); 212 DCHECK(data_.handle != base::kNullProcessHandle);
213 int exit_code; 213 int exit_code;
214 base::TerminationStatus status = GetTerminationStatus(&exit_code); 214 base::TerminationStatus status = GetTerminationStatus(&exit_code);
215 switch (status) { 215 switch (status) {
216 case base::TERMINATION_STATUS_PROCESS_CRASHED: 216 case base::TERMINATION_STATUS_PROCESS_CRASHED:
217 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: { 217 case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: {
218 delegate_->OnProcessCrashed(exit_code); 218 delegate_->OnProcessCrashedOrWasKilled(exit_code);
219 // Report that this child process crashed. 219 // Report that this child process crashed.
220 Notify(content::NOTIFICATION_CHILD_PROCESS_CRASHED); 220 Notify(content::NOTIFICATION_CHILD_PROCESS_CRASHED);
221 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed", 221 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed",
222 data_.type, 222 data_.type,
223 content::PROCESS_TYPE_MAX); 223 content::PROCESS_TYPE_MAX);
224 if (disconnect_was_alive_) { 224 if (disconnect_was_alive_) {
225 UMA_HISTOGRAM_ENUMERATION("ChildProcess.CrashedWasAlive", 225 UMA_HISTOGRAM_ENUMERATION("ChildProcess.CrashedWasAlive",
226 data_.type, 226 data_.type,
227 content::PROCESS_TYPE_MAX); 227 content::PROCESS_TYPE_MAX);
228 } 228 }
229 break; 229 break;
230 } 230 }
231 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { 231 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: {
232 delegate_->OnProcessCrashedOrWasKilled(exit_code);
jam 2012/01/26 03:56:18 it seems that consumers don't care if it crashed b
dgrogan 2012/01/26 04:17:39 I didn't want to blur the line between crashed and
232 // Report that this child process was killed. 233 // Report that this child process was killed.
233 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed", 234 UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed",
234 data_.type, 235 data_.type,
235 content::PROCESS_TYPE_MAX); 236 content::PROCESS_TYPE_MAX);
236 if (disconnect_was_alive_) { 237 if (disconnect_was_alive_) {
237 UMA_HISTOGRAM_ENUMERATION("ChildProcess.KilledWasAlive", 238 UMA_HISTOGRAM_ENUMERATION("ChildProcess.KilledWasAlive",
238 data_.type, 239 data_.type,
239 content::PROCESS_TYPE_MAX); 240 content::PROCESS_TYPE_MAX);
240 } 241 }
241 break; 242 break;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 310
310 311
311 void BrowserChildProcessHostImpl::OnProcessLaunched() { 312 void BrowserChildProcessHostImpl::OnProcessLaunched() {
312 if (!child_process_->GetHandle()) { 313 if (!child_process_->GetHandle()) {
313 delete delegate_; // Will delete us 314 delete delegate_; // Will delete us
314 return; 315 return;
315 } 316 }
316 data_.handle = child_process_->GetHandle(); 317 data_.handle = child_process_->GetHandle();
317 delegate_->OnProcessLaunched(); 318 delegate_->OnProcessLaunched();
318 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698