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

Side by Side Diff: chrome/browser/child_process_launcher.cc

Issue 5172009: This adds some plumbing for propagating the reason for a renderer's death (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final review changes Created 10 years 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) 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/child_process_launcher.h" 5 #include "chrome/browser/child_process_launcher.h"
6 6
7 #include <utility> // For std::pair. 7 #include <utility> // For std::pair.
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lock.h" 10 #include "base/lock.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 bool ChildProcessLauncher::IsStarting() { 305 bool ChildProcessLauncher::IsStarting() {
306 return context_->starting_; 306 return context_->starting_;
307 } 307 }
308 308
309 base::ProcessHandle ChildProcessLauncher::GetHandle() { 309 base::ProcessHandle ChildProcessLauncher::GetHandle() {
310 DCHECK(!context_->starting_); 310 DCHECK(!context_->starting_);
311 return context_->process_.handle(); 311 return context_->process_.handle();
312 } 312 }
313 313
314 bool ChildProcessLauncher::DidProcessCrash() { 314 base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus(
315 bool did_crash, child_exited; 315 int* exit_code) {
316 base::TerminationStatus status;
316 base::ProcessHandle handle = context_->process_.handle(); 317 base::ProcessHandle handle = context_->process_.handle();
317 #if defined(OS_LINUX) 318 #if defined(OS_LINUX)
318 if (context_->zygote_) { 319 if (context_->zygote_) {
319 did_crash = ZygoteHost::GetInstance()->DidProcessCrash(handle, 320 status = ZygoteHost::GetInstance()->GetTerminationStatus(handle, exit_code);
320 &child_exited);
321 } else 321 } else
322 #endif 322 #endif
323 { 323 {
324 did_crash = base::DidProcessCrash(&child_exited, handle); 324 status = base::GetTerminationStatus(handle, exit_code);
325 } 325 }
326 326
327 // POSIX: If the process crashed, then the kernel closed the socket for it 327 // POSIX: If the process crashed, then the kernel closed the socket
328 // and so the child has already died by the time we get here. Since 328 // for it and so the child has already died by the time we get
329 // DidProcessCrash called waitpid with WNOHANG, it'll reap the process. 329 // here. Since GetTerminationStatus called waitpid with WNOHANG,
330 // However, if DidProcessCrash didn't reap the child, we'll need to in 330 // it'll reap the process. However, if GetTerminationStatus didn't
331 // reap the child (because it was still running), we'll need to
331 // Terminate via ProcessWatcher. So we can't close the handle here. 332 // Terminate via ProcessWatcher. So we can't close the handle here.
332 if (child_exited) 333 if (status != base::TERMINATION_STATUS_STILL_RUNNING)
333 context_->process_.Close(); 334 context_->process_.Close();
334 335
335 return did_crash; 336 return status;
336 } 337 }
337 338
338 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { 339 void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
339 DCHECK(!context_->starting_); 340 DCHECK(!context_->starting_);
340 context_->process_.SetProcessBackgrounded(background); 341 context_->process_.SetProcessBackgrounded(background);
341 } 342 }
OLDNEW
« no previous file with comments | « chrome/browser/child_process_launcher.h ('k') | chrome/browser/child_process_security_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698